Diff

Not logged in

Differences From Artifact [36c6085700197d43]:

To Artifact [5518278e91d2e2fc]:


1 private import win32.windows; 1 private import win32.windows; 2 private import win32.commctrl; 2 private import win32.commctrl; 3 private import std.string; 3 private import std.string; 4 private import qbga32; < 5 4 6 void process_messages() 5 void process_messages() 7 { 6 { 8 for( MSG msg; PeekMessageA( &msg, null, 0, 0, PM_REMOVE ); ) 7 for( MSG msg; PeekMessageA( &msg, null, 0, 0, PM_REMOVE ); ) 9 { 8 { 10 TranslateMessage( &msg ); 9 TranslateMessage( &msg ); 11 DispatchMessageA( &msg ); 10 DispatchMessageA( &msg ); 12 } 11 } 13 } 12 } 14 13 15 // 実装継承(w < 16 < 17 class Dialog 14 class Dialog 18 { 15 { 19 public: 16 public: 20 HWND hwnd() 17 HWND hwnd() 21 { 18 { 22 return handle; 19 return handle; 23 } 20 } 24 21 25 protected: 22 protected: 26 void on_init() { MessageBoxA(null,"xxx",null,MB_OK); } | 23 void on_init() {} 27 bool on_ok() { return false; } 24 bool on_ok() { return false; } 28 bool on_cancel() { return false; } 25 bool on_cancel() { return false; } 29 bool on_command( UINT cmd ) { return false; } 26 bool on_command( UINT cmd ) { return false; } 30 bool on_message( UINT msg, WPARAM wp, LPARAM lp ) { return false; } 27 bool on_message( UINT msg, WPARAM wp, LPARAM lp ) { return false; } 31 28 32 extern(Windows) private static BOOL 29 extern(Windows) private static BOOL 33 static_dlg_proc( HWND dlg, UINT msg, WPARAM wp, LPARAM lp ) 30 static_dlg_proc( HWND dlg, UINT msg, WPARAM wp, LPARAM lp ) ................................................................................................................................................................................ 57 } 54 } 58 55 59 protected: 56 protected: 60 HWND handle; 57 HWND handle; 61 void BeginModeless( DLGTEMPLATE* dlg_template, HWND parent ) 58 void BeginModeless( DLGTEMPLATE* dlg_template, HWND parent ) 62 { 59 { 63 CreateDialogIndirectParam( 60 CreateDialogIndirectParam( 64 g_hinst, | 61 GetModuleHandle(null), 65 dlg_template, 62 dlg_template, 66 parent, 63 parent, 67 &static_dlg_proc, 64 &static_dlg_proc, 68 cast(LPARAM) cast(Dialog*) this 65 cast(LPARAM) cast(Dialog*) this 69 ); 66 ); 70 } 67 } 71 68 72 int BeginModal( DLGTEMPLATE* dlg_template, HWND parent ) 69 int BeginModal( DLGTEMPLATE* dlg_template, HWND parent ) 73 { 70 { 74 return DialogBoxIndirectParam( 71 return DialogBoxIndirectParam( 75 g_hinst, | 72 GetModuleHandle(null), 76 dlg_template, 73 dlg_template, 77 parent, 74 parent, 78 &static_dlg_proc, 75 &static_dlg_proc, 79 cast(LPARAM) cast(Dialog*) this 76 cast(LPARAM) cast(Dialog*) this 80 ); 77 ); 81 } 78 } 82 79