615b027a67a2a42e5528811a073eb5e74c49da9e
[openafs.git] / src / WINNT / afsapplib / al_wizard.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef AL_WIZARD_H
11 #define AL_WIZARD_H
12
13 #include <windows.h>
14 #include <prsht.h>
15 #include <WINNT/TaLocale.h>
16 #include <WINNT/subclass.h>
17
18 #ifndef EXPORTED
19 #define EXPORTED
20 #endif
21
22
23 /*
24  * DEFINITIONS ________________________________________________________________
25  *
26  */
27
28 #ifndef THIS_HINST
29 #define THIS_HINST   (HINSTANCE)GetModuleHandle(NULL)
30 #endif
31
32 #define IDC_WIZARD   898  // WM_COMMAND,IDC_WIZARD: HIWORD(wp)=WIZARD_COMAMND
33
34 typedef class EXPORTED WIZARD WIZARD, *LPWIZARD;
35
36
37 /*
38  * WIZARD CLASS _______________________________________________________________
39  *
40  */
41
42 typedef enum
43    {
44    wcSTATE_ENTER,       // now entering state (even w/o display)
45    wcSTATE_LEAVE,       // now leaving state (even w/o display)
46    wcIS_STATE_DISABLED, // return TRUE if state disabled
47    } WIZARD_COMMAND;
48
49 typedef struct
50    {
51    int st;      // numeric state identifier
52    int idd;     // dialog template for wizard pane
53    DLGPROC dlgproc;     // dialog procedure for this state
54    LPARAM lp;   // lparam for dialog initialization
55    } WIZARD_STATE, *LPWIZARD_STATE;
56
57 #define BACK_BUTTON    0x0001
58 #define NEXT_BUTTON    0x0002
59
60 class EXPORTED WIZARD
61    {
62    public:
63
64       WIZARD (void);
65       ~WIZARD (void);
66
67       static LPWIZARD GetWizard (HWND hWnd);
68       HWND GetWindow (void);
69
70       void SetDialogTemplate (int iddTemplate, int idcLeftPane, int idcRightPane, int idcBack, int idcNext);
71       void SetGraphic (int idbGraphic16, int idbGraphic256);
72       void SetStates (LPWIZARD_STATE aStates, size_t cStates);
73       void SetGraphicCallback (void (CALLBACK *pfnCallback)(LPWIZARD pWiz, HDC hdcTarget, LPRECT prTarget, HPALETTE hPal));
74
75       int GetState (void);
76       void SetState (int stNew, BOOL fForce = FALSE);
77       BOOL Show (BOOL fShow = TRUE);
78
79       void SetBackground (int iddBackground, BOOL fBlue = TRUE, DLGPROC dlgproc = NULL);
80       void SetBackgroundText (LPTSTR pszText, HFONT hfText = NULL);
81       void SetBackgroundText (int idsText, HFONT hfText = NULL);
82       BOOL ShowBackground (BOOL fShow = TRUE);
83       HWND GetBackgroundWindow (void);
84
85       void EnableButton (int idcButton, BOOL fEnable);
86       void EnableButtons (DWORD dwButtonFlags = BACK_BUTTON | NEXT_BUTTON);
87       void SetButtonText (int idcButton, int idsText);
88       void SetDefaultControl (int idc);
89
90       BOOL SendStateCommand (int st, WIZARD_COMMAND wc);
91
92    private:
93
94       void Refresh (DWORD dwRefFlags);
95       HWND GetRightHandWindow (void);
96       void GeneratePalette (RGBQUAD *pargb = NULL);
97       LPWIZARD_STATE FindState (int stFind);
98
99       static BOOL CALLBACK Background_DlgProc (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
100       static BOOL CALLBACK Background_PaintHook (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
101       void Background_OnInitDialog (HWND hBkg);
102       void Background_OnSize (void);
103       void Background_OnDestroy (void);
104       void Background_OnClose (void);
105       BOOL Background_OnPaint (void);
106
107       static BOOL CALLBACK Template_DlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
108       static BOOL CALLBACK Template_LeftPaneHook (HWND hLHS, UINT msg, WPARAM wp, LPARAM lp);
109       BOOL Template_ForwardMessage (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
110       void Template_OnInitDialog (HWND hWnd);
111       BOOL Template_OnPaintLHS (HWND hLHS);
112
113       int m_iddTemplate;
114       int m_idcLeftPane;
115       int m_idcRightPane;
116       int m_idcBack;
117       int m_idcNext;
118       int m_idbGraphic16;
119       HBITMAP m_bmpGraphic16;
120       int m_idbGraphic256;
121       HBITMAP m_bmpGraphic256;
122       HPALETTE m_palGraphic;
123       LPWIZARD_STATE m_aStates;
124       size_t m_cStates;
125       int m_stCurrent;
126       BOOL m_fShowing;
127       HWND m_hWnd;
128
129       int m_iddBackground;
130       BOOL m_fBlue;
131       HWND m_hBkg;
132       DLGPROC m_fnBackground;
133       TCHAR m_szBackground[ cchRESOURCE ];
134       HBITMAP m_bmpBackground;
135       HFONT m_hfBackground;
136       HBITMAP m_bmpBuffer;
137       RECT m_rBuffer;
138
139       void (CALLBACK *m_pfnCallback)(LPWIZARD pWiz, HDC hdcTarget, LPRECT prTarget, HPALETTE hPal);
140    };
141
142
143 #endif
144