]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dialog.h
added some macros to define version strings from version number (instead of having...
[wxWidgets.git] / include / wx / motif / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.h
3 // Purpose: wxDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #ifdef __GNUG__
16 #pragma interface "dialog.h"
17 #endif
18
19 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
20
21 class WXDLLEXPORT wxEventLoop;
22
23 // Dialog boxes
24 class WXDLLEXPORT wxDialog : public wxDialogBase
25 {
26 DECLARE_DYNAMIC_CLASS(wxDialog)
27
28 public:
29 wxDialog();
30
31 #if WXWIN_COMPATIBILITY_2
32 // Constructor with a modal flag, but no window id - the old convention
33 wxDialog(wxWindow *parent,
34 const wxString& title, bool modal,
35 int x = -1, int y= -1, int width = 500, int height = 500,
36 long style = wxDEFAULT_DIALOG_STYLE,
37 const wxString& name = wxDialogNameStr)
38 {
39 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
40 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name);
41 }
42 #endif
43
44 // Constructor with no modal flag - the new convention.
45 wxDialog(wxWindow *parent, wxWindowID id,
46 const wxString& title,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = wxDEFAULT_DIALOG_STYLE,
50 const wxString& name = wxDialogNameStr)
51 {
52 Create(parent, id, title, pos, size, style, name);
53 }
54
55 bool Create(wxWindow *parent, wxWindowID id,
56 const wxString& title, // bool modal = FALSE, // TODO make this a window style?
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = wxDEFAULT_DIALOG_STYLE,
60 const wxString& name = wxDialogNameStr);
61
62 ~wxDialog();
63
64 virtual bool Destroy();
65
66 virtual bool Show(bool show = TRUE);
67
68 void SetTitle(const wxString& title);
69
70 void SetModal(bool flag);
71
72 virtual bool IsModal() const
73 { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
74
75 virtual int ShowModal();
76 virtual void EndModal(int retCode);
77
78 // Implementation
79 virtual void ChangeFont(bool keepOriginalSize = TRUE);
80 virtual void ChangeBackgroundColour();
81 virtual void ChangeForegroundColour();
82 inline WXWidget GetTopWidget() const { return m_mainWidget; }
83 inline WXWidget GetClientWidget() const { return m_mainWidget; }
84
85 // Standard buttons
86 void OnOK(wxCommandEvent& event);
87 void OnApply(wxCommandEvent& event);
88 void OnCancel(wxCommandEvent& event);
89
90 // Responds to colour changes
91 void OnSysColourChanged(wxSysColourChangedEvent& event);
92
93 void OnCharHook(wxKeyEvent& event);
94 void OnCloseWindow(wxCloseEvent& event);
95
96 private:
97 virtual bool DoCreate( wxWindow* parent, wxWindowID id,
98 const wxString& title,
99 const wxPoint& pos,
100 const wxSize& size,
101 long style,
102 const wxString& name );
103 virtual void DoDestroy();
104
105 //// Motif-specific
106 bool m_modalShowing;
107 wxEventLoop* m_eventLoop;
108
109 protected:
110 virtual void DoSetSize(int x, int y,
111 int width, int height,
112 int sizeFlags = wxSIZE_AUTO);
113
114 virtual void DoSetClientSize(int width, int height);
115
116 private:
117 DECLARE_EVENT_TABLE()
118 };
119
120 #endif
121 // _WX_DIALOG_H_