Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get height of window's title bar?

Tags:

c++

wxwidgets

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?

Here is a simple illustration of what I need: title bar height (h)

like image 217
Tunahan Avatar asked Dec 29 '25 09:12

Tunahan


1 Answers

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

like image 195
avariant Avatar answered Dec 30 '25 23:12

avariant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!