comparison foosdk/sdk/foobar2000/helpers/win32_dialog.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 #ifdef FOOBAR2000_DESKTOP_WINDOWS
4
5 //DEPRECATED dialog helpers - kept only for compatibility with old code - do not use in new code, use WTL instead.
6
7 namespace dialog_helper
8 {
9
10 class dialog
11 {
12 protected:
13
14 dialog() : wnd(0), m_is_modal(false) {}
15 ~dialog() { }
16
17 virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp)=0;
18
19 void end_dialog(int code);
20
21 public:
22 inline HWND get_wnd() {return wnd;}
23
24 __declspec(deprecated) int run_modal(unsigned id,HWND parent);
25
26 __declspec(deprecated) HWND run_modeless(unsigned id,HWND parent);
27 private:
28 HWND wnd;
29 static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
30
31 bool m_is_modal;
32
33 modal_dialog_scope m_modal_scope;
34 };
35
36 //! This class is meant to be instantiated on-stack, as a local variable. Using new/delete operators instead or even making this a member of another object works, but does not make much sense because of the way this works (single run() call).
37 class dialog_modal
38 {
39 public:
40 __declspec(deprecated) int run(unsigned p_id,HWND p_parent,HINSTANCE p_instance = core_api::get_my_instance());
41 protected:
42 virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp)=0;
43
44 inline dialog_modal() : m_wnd(0) {}
45 void end_dialog(int p_code);
46 inline HWND get_wnd() const {return m_wnd;}
47 private:
48 static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
49
50 HWND m_wnd;
51 modal_dialog_scope m_modal_scope;
52 };
53
54 };
55
56 //! Wrapper (provided mainly for old code), simplifies parameters compared to standard CreateDialog() by using core_api::get_my_instance().
57 HWND uCreateDialog(UINT id,HWND parent,DLGPROC proc,LPARAM param = 0);
58 //! Wrapper (provided mainly for old code), simplifies parameters compared to standard DialogBox() by using core_api::get_my_instance().
59 int uDialogBox(UINT id,HWND parent,DLGPROC proc,LPARAM param = 0);
60
61
62 #endif // FOOBAR2000_DESKTOP_WINDOWS