00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __WIN32DLG_H__
00013 #define __WIN32DLG_H__
00014
00015 #include <win32wbase.h>
00016
00017 #ifdef __cplusplus
00018
00019 #define DF_END 0x0001
00020
00021
00022 typedef struct
00023 {
00024 DWORD style;
00025 DWORD exStyle;
00026 DWORD helpId;
00027 INT x;
00028 INT y;
00029 INT cx;
00030 INT cy;
00031 UINT id;
00032 LPCSTR className;
00033 LPCSTR windowName;
00034 LPVOID data;
00035 } DLG_CONTROL_INFO;
00036
00037
00038 typedef struct
00039 {
00040 DWORD style;
00041 DWORD exStyle;
00042 DWORD helpId;
00043 UINT nbItems;
00044 INT x;
00045 INT y;
00046 INT cx;
00047 INT cy;
00048 LPCSTR menuName;
00049 LPCSTR className;
00050 LPCSTR caption;
00051 WORD pointSize;
00052 WORD weight;
00053 BOOL italic;
00054 LPCSTR faceName;
00055 BOOL dialogEx;
00056 } DLG_TEMPLATE;
00057
00058 class Win32Dialog : public Win32BaseWindow
00059 {
00060 public:
00061 Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner,
00062 DLGPROC dlgProc, LPARAM param, BOOL isUnicode);
00063
00064 virtual ~Win32Dialog();
00065
00066 LRESULT DefDlgProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
00067 LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam);
00068
00069 HWND getDlgItem(int id) { return FindWindowById(id); };
00070
00071 BOOL endDialog(int retval);
00072
00073 BOOL MapDialogRect(LPRECT rect);
00074
00075 virtual ULONG MsgCreate(HWND hwndOS2);
00076
00077 virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
00078 virtual ULONG GetWindowLong(int index, BOOL fUnicode);
00079
00080 static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); };
00081
00082 INT doDialogBox();
00083
00084 protected:
00085 BOOL DIALOG_Init(void);
00086 BOOL getCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize );
00087 BOOL getCharSize( HFONT hFont, SIZE * pSize);
00088 LPCSTR parseTemplate( LPCSTR dlgtemplate, DLG_TEMPLATE *result);
00089 WORD *getControl(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx);
00090 BOOL createControls(LPCSTR dlgtemplate, HINSTANCE hInst);
00091
00092 LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam);
00093 LRESULT DefDlg_Epilog(UINT msg, BOOL fResult);
00094
00095 BOOL setDefButton(HWND hwndNew );
00096 HWND findDefButton();
00097 BOOL saveFocus();
00098 BOOL restoreFocus();
00099 void setFocus(HWND hwndCtrl );
00100
00101
00102 DLGPROC Win32DlgProc;
00103 ULONG msgResult;
00104 ULONG userDlgData;
00105
00106 DLG_TEMPLATE dlgInfo;
00107 WORD xUnit;
00108 WORD yUnit;
00109 HWND hwndFocus;
00110 HFONT hUserFont;
00111 HMENU hMenu;
00112 DWORD idResult;
00113 DWORD dialogFlags;
00114 BOOL fDialogInit;
00115
00116 DWORD tmpParam;
00117 LPSTR tmpDlgTemplate;
00118
00119 private:
00120 static BOOL fInitialized;
00121 static int xBaseUnit;
00122 static int yBaseUnit;
00123 };
00124
00125
00126 #define DIALOG_CLASS_NAMEA "#32770"
00127 #define DIALOG_CLASS_NAMEW L"#32770"
00128 #define DIALOG_CLASS_ATOM 32770
00129
00130 BOOL DIALOG_Register();
00131 BOOL DIALOG_Unregister();
00132
00133 #endif //__cplusplus
00134
00135 #endif //__WIN32WND_H__