I am working on some code about capturing mouse location. I have a frame created by using wxWidgets, and I am working on an issue which I need to get the title bar height. Is there a good way to get the size of title bar?
Asked
Active
Viewed 557 times
3
-
1i think this might be the answer to your question https://stackoverflow.com/a/431548/11118883 – Bekaert L Apr 09 '19 at 13:03
-
Did you just assume that the title bar always sits on top of your window? [Big mistake](https://en.m.wikipedia.org/wiki/FLWM#/media/File%3AFLWM_Screenshot.png). – n. m. could be an AI Apr 09 '19 at 13:22
-
I assume that the title bar always sits on top. @n.m. – Tunahan Apr 09 '19 at 13:29
2 Answers
4
wxWidgets provides a mechanism for this (and much else beside) called wxSystemSettings::GetMetric
.
static int wxSystemSettings::GetMetric(wxSystemMetric index, wxWindow* win = NULL);
You can retrieve 'global' values by leaving win
as NULL
or you can pass in a specific window.
https://docs.wxwidgets.org/trunk/classwx_system_settings.html#aa18e3b5794dc4193c4b0668d28d4933a
The metric you probably want is wxSYS_CAPTION_Y
.
https://docs.wxwidgets.org/trunk/settings_8h.html#a0f2b19d7a3717cdbef5a04cb05ab8f26

avariant
- 2,234
- 5
- 25
- 33
-
`wxSYS_CAPTION_Y` is the thing I am looking for. Thanks for the great documented response. – Tunahan Apr 09 '19 at 15:31
0
It should be the y
coordinate of what wxWindow::GetClientAreaOrigin()
returns.

catalin
- 1,927
- 20
- 20
-
Both of the `x` and `y` values of `wxWindow::GetClientAreaOrigin()` returns zero, then I couldn't get the right thing. – Tunahan Apr 09 '19 at 13:16