]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dialog.h
regrouped the fix by VZ so that __MWERKS__ comes first, since CW also defines _MSC_VE...
[wxWidgets.git] / include / wx / msw / dialog.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialog.h
3// Purpose: wxDialog class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_DIALOG_H_
13#define _WX_DIALOG_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "dialog.h"
17#endif
18
19#include "wx/panel.h"
20
21WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
22
23// Dialog boxes
24class WXDLLEXPORT wxDialog: public wxPanel
25{
26 DECLARE_DYNAMIC_CLASS(wxDialog)
27 protected:
28 bool m_modalShowing;
29public:
30
31 wxDialog(void);
32
33 // Constructor with a modal flag, but no window id - the old convention
34 inline wxDialog(wxWindow *parent,
35 const wxString& title, bool modal,
debe6624
JS
36 int x = -1, int y= -1, int width = 500, int height = 500,
37 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
38 const wxString& name = wxDialogNameStr)
39 {
40 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
41 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name);
42 }
43
44 // Constructor with no modal flag - the new convention.
debe6624 45 inline wxDialog(wxWindow *parent, wxWindowID id,
2bda0e17
KB
46 const wxString& title,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
debe6624 49 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
50 const wxString& name = wxDialogNameStr)
51 {
52 Create(parent, id, title, pos, size, style, name);
53 }
54
debe6624 55 bool Create(wxWindow *parent, wxWindowID id,
2bda0e17
KB
56 const wxString& title, // bool modal = FALSE, // TODO make this a window style?
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
debe6624 59 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
60 const wxString& name = wxDialogNameStr);
61
62 ~wxDialog(void);
63
64 virtual bool Destroy(void);
debe6624 65 void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
4fabb575
JS
66 void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
67 { wxWindow::SetSize(rect, sizeFlags); }
68 void SetSize(const wxSize& size) { wxWindow::SetSize(size); }
69
debe6624 70 void SetClientSize(int width, int height);
4fabb575
JS
71 void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
72
2bda0e17 73 void GetPosition(int *x, int *y) const;
4fabb575
JS
74 wxPoint GetPosition() const { return wxWindow::GetPosition(); }
75
debe6624 76 bool Show(bool show);
2bda0e17 77 bool IsShown(void) const ;
debe6624 78 void Iconize(bool iconize);
2bda0e17
KB
79
80#if WXWIN_COMPATIBILITY
81 inline bool Iconized(void) const { return IsIconized(); };
82#endif
83
84 virtual bool IsIconized(void) const;
85 void Fit(void);
86
87 void SetTitle(const wxString& title);
88 wxString GetTitle(void) const ;
89
90 bool OnClose(void);
91 void OnCharHook(wxKeyEvent& event);
92 void OnPaint(wxPaintEvent& event);
93 void OnCloseWindow(wxCloseEvent& event);
94
debe6624 95 void SetModal(bool flag);
2bda0e17 96
debe6624 97 virtual void Centre(int direction = wxBOTH);
2bda0e17
KB
98 virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
99
100 // For now, same as Show(TRUE) but returns return code
101 virtual int ShowModal(void);
102 virtual void EndModal(int retCode);
103
104 // Standard buttons
105 void OnOK(wxCommandEvent& event);
106 void OnApply(wxCommandEvent& event);
107 void OnCancel(wxCommandEvent& event);
108
109 // Responds to colour changes
110 void OnSysColourChanged(wxSysColourChangedEvent& event);
111
112 // IMPLEMENTATION
113 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
114 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
115 virtual bool MSWProcessMessage(WXMSG* pMsg);
116// virtual bool MSWOnEraseBkgnd(WXHDC pDC);
117 virtual bool MSWOnClose(void);
118 inline bool IsModalShowing() const { return m_modalShowing ; }
debe6624 119 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
2bda0e17
KB
120 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
121
dc1c4b62
VZ
122protected:
123 WXHWND m_hwndOldFocus; // the window which had focus before we were shown
124
2bda0e17
KB
125DECLARE_EVENT_TABLE()
126};
127
128#endif
bbcdf8bc 129 // _WX_DIALOG_H_