| 1 | /* $Id: win32dlg.h,v 1.6 1999-09-05 15:53:09 sandervl Exp $ */
|
|---|
| 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 |
|
|---|
| 15 | #include <win32wbase.h>
|
|---|
| 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 |
|
|---|
| 37 | /* Dialog template */
|
|---|
| 38 | typedef struct
|
|---|
| 39 | {
|
|---|
| 40 | DWORD style;
|
|---|
| 41 | DWORD exStyle;
|
|---|
| 42 | DWORD helpId;
|
|---|
| 43 | UINT nbItems;
|
|---|
| 44 | INT x;
|
|---|
| 45 | INT y;
|
|---|
| 46 | INT cx;
|
|---|
| 47 | INT cy;
|
|---|
| 48 | LPCSTR menuName;
|
|---|
| 49 | LPCSTR className;
|
|---|
| 50 | LPCSTR caption;
|
|---|
| 51 | WORD pointSize;
|
|---|
| 52 | WORD weight;
|
|---|
| 53 | BOOL italic;
|
|---|
| 54 | LPCSTR faceName;
|
|---|
| 55 | BOOL dialogEx;
|
|---|
| 56 | } DLG_TEMPLATE;
|
|---|
| 57 |
|
|---|
| 58 | class Win32Dialog : public Win32BaseWindow
|
|---|
| 59 | {
|
|---|
| 60 | public:
|
|---|
| 61 | Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner,
|
|---|
| 62 | DLGPROC dlgProc, LPARAM param, BOOL isUnicode);
|
|---|
| 63 |
|
|---|
| 64 | virtual ~Win32Dialog();
|
|---|
| 65 |
|
|---|
| 66 | LRESULT DefDlgProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 67 | LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 68 |
|
|---|
| 69 | Win32BaseWindow *getDlgItem(int id);
|
|---|
| 70 |
|
|---|
| 71 | HWND getNextDlgTabItem(HWND hwndCtrl, BOOL fPrevious);
|
|---|
| 72 | BOOL endDialog(int retval);
|
|---|
| 73 |
|
|---|
| 74 | virtual ULONG MsgOS2Create(HWND hwndOS2, ULONG initParam);
|
|---|
| 75 |
|
|---|
| 76 | virtual LONG SetWindowLongA(int index, ULONG value);
|
|---|
| 77 | virtual ULONG GetWindowLongA(int index);
|
|---|
| 78 |
|
|---|
| 79 | static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); };
|
|---|
| 80 |
|
|---|
| 81 | INT doDialogBox();
|
|---|
| 82 |
|
|---|
| 83 | protected:
|
|---|
| 84 | BOOL DIALOG_Init(void);
|
|---|
| 85 | BOOL getCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize );
|
|---|
| 86 | BOOL getCharSize( HFONT hFont, SIZE * pSize);
|
|---|
| 87 | LPCSTR parseTemplate( LPCSTR dlgtemplate, DLG_TEMPLATE *result);
|
|---|
| 88 | WORD *getControl(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx);
|
|---|
| 89 | BOOL createControls(LPCSTR dlgtemplate, HINSTANCE hInst);
|
|---|
| 90 |
|
|---|
| 91 | LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 92 | LRESULT DefDlg_Epilog(UINT msg, BOOL fResult);
|
|---|
| 93 |
|
|---|
| 94 | BOOL setDefButton(HWND hwndNew );
|
|---|
| 95 | HWND findDefButton();
|
|---|
| 96 | BOOL saveFocus();
|
|---|
| 97 | BOOL restoreFocus();
|
|---|
| 98 | void setFocus(HWND hwndCtrl );
|
|---|
| 99 |
|
|---|
| 100 | // values normally contained in the standard dialog words
|
|---|
| 101 | DLGPROC Win32DlgProc; //DWL_WNDPROC
|
|---|
| 102 | ULONG msgResult; //DWL_MSGRESULT
|
|---|
| 103 | ULONG userDlgData; //DWL_USER
|
|---|
| 104 |
|
|---|
| 105 | DLG_TEMPLATE dlgInfo;
|
|---|
| 106 | WORD xUnit;
|
|---|
| 107 | WORD yUnit;
|
|---|
| 108 | HWND hwndFocus;
|
|---|
| 109 | HFONT hUserFont;
|
|---|
| 110 | HMENU hMenu;
|
|---|
| 111 | DWORD idResult;
|
|---|
| 112 | DWORD dialogFlags;
|
|---|
| 113 |
|
|---|
| 114 | private:
|
|---|
| 115 | static BOOL fInitialized;
|
|---|
| 116 | static int xBaseUnit;
|
|---|
| 117 | static int yBaseUnit;
|
|---|
| 118 | };
|
|---|
| 119 |
|
|---|
| 120 | /* Built-in class names (see _Undocumented_Windows_ p.418) */
|
|---|
| 121 | #define DIALOG_CLASS_NAMEA "#32770" /* Dialog */
|
|---|
| 122 | #define DIALOG_CLASS_NAMEW L"#32770" /* Dialog */
|
|---|
| 123 | #define DIALOG_CLASS_ATOM 32770 /* Dialog */
|
|---|
| 124 |
|
|---|
| 125 | BOOL DIALOG_Register();
|
|---|
| 126 | BOOL DIALOG_Unregister();
|
|---|
| 127 |
|
|---|
| 128 | #endif //__cplusplus
|
|---|
| 129 |
|
|---|
| 130 | #endif //__WIN32WND_H__
|
|---|