Differences From Artifact [983218cb4853f610]:
- File
src/qbga_gui.d
- 2011-02-23 12:53:16 - part of checkin [c2b7a98c21] on branch trunk - Initial import (user: kinaba) [annotate]
To Artifact [36c6085700197d43]:
- File
src/qbga_gui.d
- 2015-04-21 10:46:55 - part of checkin [4e2933c620] on branch trunk - Rebased to the latest verson dmd 2.067. Not yet verified the outcome. (user: kinaba) [annotate]
1 -private import std.string;
2 -private import win32.ansi.windows;
3 -private import win32.ansi.commctrl;
1 +private import win32.windows;
2 +private import win32.commctrl;
3 +private import std.string;
4 4 private import qbga32;
5 5
6 6 void process_messages()
7 7 {
8 - for( MSG msg; PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ); )
8 + for( MSG msg; PeekMessageA( &msg, null, 0, 0, PM_REMOVE ); )
9 9 {
10 10 TranslateMessage( &msg );
11 - DispatchMessage( &msg );
11 + DispatchMessageA( &msg );
12 12 }
13 13 }
14 14
15 15 // 実装継承(w
16 16
17 17 class Dialog
18 18 {
................................................................................
19 19 public:
20 20 HWND hwnd()
21 21 {
22 22 return handle;
23 23 }
24 24
25 25 protected:
26 - void on_init() { MessageBox(null,"xxx",null,MB_OK); }
26 + void on_init() { MessageBoxA(null,"xxx",null,MB_OK); }
27 27 bool on_ok() { return false; }
28 28 bool on_cancel() { return false; }
29 29 bool on_command( UINT cmd ) { return false; }
30 30 bool on_message( UINT msg, WPARAM wp, LPARAM lp ) { return false; }
31 31
32 32 extern(Windows) private static BOOL
33 33 static_dlg_proc( HWND dlg, UINT msg, WPARAM wp, LPARAM lp )
................................................................................
76 76 dlg_template,
77 77 parent,
78 78 &static_dlg_proc,
79 79 cast(LPARAM) cast(Dialog*) this
80 80 );
81 81 }
82 82
83 - void set_item_text( int ID, char[] str )
83 + void set_item_text( int ID, string str )
84 84 {
85 - SetDlgItemText( handle, ID, toStringz(str) );
85 + SetDlgItemTextA( handle, ID, toStringz(str) );
86 86 }
87 87
88 88 int send_item_msg( int ID, UINT msg, WPARAM wp=0, LPARAM lp=0 )
89 89 {
90 90 return SendDlgItemMessage( handle, ID, msg, wp, lp );
91 91 }
92 92 }
................................................................................
102 102 class ProgressDlg : Dialog
103 103 {
104 104 this( DLGTEMPLATE* dlg_template, HWND parent )
105 105 {
106 106 BeginModeless( dlg_template, parent );
107 107 }
108 108
109 - void set_arcname ( char[] str ){ set_item_text( 2006, str ); }
110 - void set_filename( char[] str ){ set_item_text( 2007, str ); }
109 + void set_arcname ( string str ){ set_item_text( 2006, str ); }
110 + void set_filename( string str ){ set_item_text( 2007, str ); }
111 111 void set_max( real m ) { max = m; }
112 112 void set_pos( real p ) { send_item_msg(2024,PBM_SETPOS,cast(int)(p/max*65535),0); }
113 113
114 114 bool closed()
115 115 {
116 116 return !alive;
117 117 }