Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/helpers/window_placement_helper.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 // DEPRECATED, NOT DPI SAFE | |
| 4 // use cfgDialogPosition & cfgWindowSize2 instead | |
| 5 #ifdef FOOBAR2000_DESKTOP_WINDOWS | |
| 6 | |
| 7 #include "../SDK/cfg_var.h" | |
| 8 | |
| 9 //! Window position management helpers | |
| 10 //! Usage: create a static instance, like with any cfg_var; access it on creation/reposition/destruction of your window. | |
| 11 class cfg_window_placement : public cfg_struct_t<WINDOWPLACEMENT> { | |
| 12 public: | |
| 13 cfg_window_placement(const GUID& guid) : cfg_struct_t(guid) {} | |
| 14 //! Read and save position data from HWND. | |
| 15 bool read_from_window(HWND window); | |
| 16 //! Apply saved position data to HWND. | |
| 17 bool apply_to_window(HWND window, bool allowHidden); | |
| 18 | |
| 19 // OLD methods tracking only destroy/create. | |
| 20 // Use of read_from_window() / apply_to_window() instead is preferred, so changes can be saved immediately. | |
| 21 bool on_window_creation(HWND window, bool allowHidden = false);//returns true if window position has been changed, false if not | |
| 22 void on_window_creation_silent(HWND window); | |
| 23 void on_window_destruction(HWND window); | |
| 24 }; | |
| 25 | |
| 26 // At one point there was a separate cfg_window_placement_v2 without legacy methods | |
| 27 typedef cfg_window_placement cfg_window_placement_v2; | |
| 28 | |
| 29 //! Window size tracker \n | |
| 30 //! Usage: create a static instance, like with any cfg_var; access it on creation/reposition/destruction of your window. | |
| 31 class cfg_window_size : public cfg_struct_t<SIZE> { | |
| 32 public: | |
| 33 cfg_window_size(const GUID& id) : cfg_struct_t(id) {} | |
| 34 //! Read and save size data from HWND. | |
| 35 bool read_from_window(HWND window); | |
| 36 //! Apply saved size data to HWND. | |
| 37 bool apply_to_window(HWND); | |
| 38 | |
| 39 // OLD methods tracking only destroy/create. | |
| 40 // Use of read_from_window() / apply_to_window() instead is preferred, so changes can be saved immediately. | |
| 41 bool on_window_creation(HWND window);//returns true if window position has been changed, false if not | |
| 42 void on_window_destruction(HWND window); | |
| 43 }; | |
| 44 | |
| 45 #endif // FOOBAR2000_DESKTOP_WINDOWS |
