1 #ifndef _EXPRESS_DIALOG_
2 #define _EXPRESS_DIALOG_
3 
4 #define TITLE_BAR_HEIGHT 28
5 #define STATUS_BAR_HEIGHT 41
6 
7 #define CLOSE_BUTTON_WIDTH 25
8 #define CLOSE_BUTTON_HEIGHT 21
9 
10 #define SAVE_BUTTON_WIDTH 80
11 #define SAVE_BUTTON_HEIGHT 36
12 
13 #define CANCEL_BUTTON_WIDTH 75
14 #define CANCEL_BUTTON_HEIGHT 30
15 
16 class custom_bitmap_button : public CBitmapButton
17 {
18     public:
19         custom_bitmap_button();
20         virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
21 
22     private:
23         void custom_bitmap_button::DrawBitmap(LPDRAWITEMSTRUCT lpDrawItemStruct);
24 };
25 
26 class express_dialog : public CDialog
27 {
28     public:
29         express_dialog(int width, int height);   // standard constructor
30         express_dialog(int template_id, CWnd *parent);   // constructor if it will be modal
31         virtual ~express_dialog();
32         void SetControlSize();
33         void AddSaveButton(CString title = _T("Save"));
34         void AddCancelButton(CString title = _T("Cancel"));
SetSavedMsg(CString msg)35         void SetSavedMsg(CString msg) { mSavedMsg = msg; }
36         virtual INT_PTR DoModal();
37         void ChangeDialogFontSize();
38         void CreateDialogFont(int text_scaler);
39 
40     protected:
41         DECLARE_MESSAGE_MAP()
42         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
43         afx_msg LRESULT OnNcHitTest(CPoint point);
44         afx_msg void OnSize(UINT nType, int cx, int cy);
45         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
46         afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
47         virtual BOOL PreTranslateMessage(MSG* pMsg);
48         virtual void OnOK();
49 
50         void PaintRequiredAsterisk(int control_id);
51         void PaintTitleAndStatusBar(CDC *dc);
52         void SetTitleText(CString &title);
53         void SetTitleText(char *text);
54         CStatic button_text;
55         custom_bitmap_button close_button;
56         custom_bitmap_button save_button;
57         CButton cancel_button;
58 
59         int IconId;
60         int m_width;
61         int m_height;
62         int m_title_bar_height;
63         int m_status_bar_height;
64         int m_close_button_width;
65         int m_close_button_height;
66         int m_save_button_width;
67         int m_save_button_height;
68         int m_cancel_button_width;
69         int m_cancel_button_height;
70         int m_template_id;
71         int m_text_scaler;
72         CFont m_dialog_font;
73 
74     protected:
75         CString mTitleText;
76         CString mSavedMsg;
77 };
78 
79 #endif
80