[9366] | 1 | /* $Id: win32dlg.h,v 1.15 2002-10-28 19:59:52 sandervl Exp $ */
|
---|
[2469] | 2 | /*
|
---|
| 3 | * Win32 Dialog Code for OS/2
|
---|
| 4 | *
|
---|
| 5 | *
|
---|
| 6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
| 7 | *
|
---|
| 8 | *
|
---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 10 | *
|
---|
| 11 | */
|
---|
| 12 | #ifndef __WIN32DLG_H__
|
---|
| 13 | #define __WIN32DLG_H__
|
---|
| 14 |
|
---|
[21916] | 15 | #include "win32wbase.h"
|
---|
[2469] | 16 |
|
---|
| 17 | #ifdef __cplusplus
|
---|
| 18 |
|
---|
| 19 | #define DF_END 0x0001
|
---|
| 20 |
|
---|
| 21 | /* Dialog control information */
|
---|
| 22 | typedef struct
|
---|
| 23 | {
|
---|
| 24 | DWORD style;
|
---|
| 25 | DWORD exStyle;
|
---|
| 26 | DWORD helpId;
|
---|
| 27 | INT x;
|
---|
| 28 | INT y;
|
---|
| 29 | INT cx;
|
---|
| 30 | INT cy;
|
---|
| 31 | UINT id;
|
---|
| 32 | LPCSTR className;
|
---|
| 33 | LPCSTR windowName;
|
---|
| 34 | LPVOID data;
|
---|
| 35 | } DLG_CONTROL_INFO;
|
---|
| 36 |
|
---|
[9366] | 37 | /* Some home-brewen dialog template
|
---|
| 38 | TODO: redo this and make it standart one */
|
---|
[2469] | 39 | typedef struct
|
---|
| 40 | {
|
---|
| 41 | DWORD style;
|
---|
| 42 | DWORD exStyle;
|
---|
[9366] | 43 | WORD nbItems;
|
---|
| 44 | short x;
|
---|
| 45 | short y;
|
---|
| 46 | short cx;
|
---|
| 47 | short cy;
|
---|
[2469] | 48 | DWORD helpId;
|
---|
| 49 | LPCSTR menuName;
|
---|
| 50 | LPCSTR className;
|
---|
| 51 | LPCSTR caption;
|
---|
| 52 | WORD pointSize;
|
---|
| 53 | WORD weight;
|
---|
| 54 | BOOL italic;
|
---|
| 55 | LPCSTR faceName;
|
---|
| 56 | BOOL dialogEx;
|
---|
| 57 | } DLG_TEMPLATE;
|
---|
| 58 |
|
---|
| 59 | class Win32Dialog : public Win32BaseWindow
|
---|
| 60 | {
|
---|
| 61 | public:
|
---|
| 62 | Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner,
|
---|
| 63 | DLGPROC dlgProc, LPARAM param, BOOL isUnicode);
|
---|
| 64 |
|
---|
| 65 | virtual ~Win32Dialog();
|
---|
| 66 |
|
---|
| 67 | LRESULT DefDlgProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
| 68 | LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
| 69 |
|
---|
[5935] | 70 | HWND getDlgItem(int id) { return FindWindowById(id); };
|
---|
[2469] | 71 |
|
---|
| 72 | BOOL endDialog(int retval);
|
---|
| 73 |
|
---|
| 74 | BOOL MapDialogRect(LPRECT rect);
|
---|
| 75 |
|
---|
[3662] | 76 | virtual ULONG MsgCreate(HWND hwndOS2);
|
---|
[2469] | 77 |
|
---|
[7241] | 78 | virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
|
---|
| 79 | virtual ULONG GetWindowLong(int index, BOOL fUnicode);
|
---|
[2469] | 80 |
|
---|
[4686] | 81 | static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); };
|
---|
[2469] | 82 |
|
---|
[4686] | 83 | INT doDialogBox();
|
---|
[2469] | 84 |
|
---|
| 85 | protected:
|
---|
[4686] | 86 | BOOL DIALOG_Init(void);
|
---|
| 87 | BOOL getCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize );
|
---|
| 88 | BOOL getCharSize( HFONT hFont, SIZE * pSize);
|
---|
| 89 | LPCSTR parseTemplate( LPCSTR dlgtemplate, DLG_TEMPLATE *result);
|
---|
[2469] | 90 | WORD *getControl(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx);
|
---|
[4686] | 91 | BOOL createControls(LPCSTR dlgtemplate, HINSTANCE hInst);
|
---|
| 92 |
|
---|
| 93 | LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
[2469] | 94 | LRESULT DefDlg_Epilog(UINT msg, BOOL fResult);
|
---|
| 95 |
|
---|
[4686] | 96 | BOOL setDefButton(HWND hwndNew );
|
---|
| 97 | HWND findDefButton();
|
---|
| 98 | BOOL saveFocus();
|
---|
| 99 | BOOL restoreFocus();
|
---|
| 100 | void setFocus(HWND hwndCtrl );
|
---|
[2469] | 101 |
|
---|
[4686] | 102 | // values normally contained in the standard dialog words
|
---|
| 103 | DLGPROC Win32DlgProc; //DWL_WNDPROC
|
---|
| 104 | ULONG msgResult; //DWL_MSGRESULT
|
---|
| 105 | ULONG userDlgData; //DWL_USER
|
---|
[2469] | 106 |
|
---|
| 107 | DLG_TEMPLATE dlgInfo;
|
---|
[4686] | 108 | WORD xUnit;
|
---|
| 109 | WORD yUnit;
|
---|
| 110 | HWND hwndFocus;
|
---|
| 111 | HFONT hUserFont;
|
---|
| 112 | HMENU hMenu;
|
---|
| 113 | DWORD idResult;
|
---|
| 114 | DWORD dialogFlags;
|
---|
| 115 | BOOL fDialogInit;
|
---|
[2469] | 116 |
|
---|
[4686] | 117 | DWORD tmpParam; //set in ctor, used in MsgCreate method
|
---|
| 118 | LPSTR tmpDlgTemplate; //set in ctor, used in MsgCreate method
|
---|
| 119 |
|
---|
[2469] | 120 | private:
|
---|
| 121 | static BOOL fInitialized;
|
---|
| 122 | static int xBaseUnit;
|
---|
| 123 | static int yBaseUnit;
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | /* Built-in class names (see _Undocumented_Windows_ p.418) */
|
---|
| 127 | #define DIALOG_CLASS_NAMEA "#32770" /* Dialog */
|
---|
| 128 | #define DIALOG_CLASS_NAMEW L"#32770" /* Dialog */
|
---|
| 129 | #define DIALOG_CLASS_ATOM 32770 /* Dialog */
|
---|
| 130 |
|
---|
| 131 | BOOL DIALOG_Register();
|
---|
| 132 | BOOL DIALOG_Unregister();
|
---|
| 133 |
|
---|
| 134 | #endif //__cplusplus
|
---|
| 135 |
|
---|
[4686] | 136 | #endif //__WIN32WND_H__
|
---|