]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dialog.h
wxMac should use /src/mac/carbon/spinctrl.cpp, applied some sizing
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "dialog.h"
17 #endif
18
19 class WXDLLEXPORT wxEventLoop;
20
21 // Dialog boxes
22 class WXDLLEXPORT wxDialog : public wxDialogBase
23 {
24 DECLARE_DYNAMIC_CLASS(wxDialog)
25
26 public:
27 wxDialog();
28
29 // Constructor with no modal flag - the new convention.
30 wxDialog(wxWindow *parent, wxWindowID id,
31 const wxString& title,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 long style = wxDEFAULT_DIALOG_STYLE,
35 const wxString& name = wxDialogNameStr)
36 {
37 Create(parent, id, title, pos, size, style, name);
38 }
39
40 bool Create(wxWindow *parent, wxWindowID id,
41 const wxString& title, // bool modal = FALSE, // TODO make this a window style?
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = wxDEFAULT_DIALOG_STYLE,
45 const wxString& name = wxDialogNameStr);
46
47 ~wxDialog();
48
49 virtual bool Destroy();
50
51 virtual bool Show(bool show = TRUE);
52
53 void SetTitle(const wxString& title);
54
55 void SetModal(bool flag);
56
57 virtual bool IsModal() const
58 { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
59
60 virtual int ShowModal();
61 virtual void EndModal(int retCode);
62
63 // Implementation
64 virtual void ChangeFont(bool keepOriginalSize = TRUE);
65 virtual void ChangeBackgroundColour();
66 virtual void ChangeForegroundColour();
67 inline WXWidget GetTopWidget() const { return m_mainWidget; }
68 inline WXWidget GetClientWidget() const { return m_mainWidget; }
69
70 // Standard buttons
71 void OnOK(wxCommandEvent& event);
72 void OnApply(wxCommandEvent& event);
73 void OnCancel(wxCommandEvent& event);
74
75 // Responds to colour changes
76 void OnSysColourChanged(wxSysColourChangedEvent& event);
77
78 void OnCharHook(wxKeyEvent& event);
79 void OnCloseWindow(wxCloseEvent& event);
80
81 private:
82 virtual bool DoCreate( wxWindow* parent, wxWindowID id,
83 const wxString& title,
84 const wxPoint& pos,
85 const wxSize& size,
86 long style,
87 const wxString& name );
88 virtual void DoDestroy();
89
90 //// Motif-specific
91 bool m_modalShowing;
92 wxEventLoop* m_eventLoop;
93
94 protected:
95 virtual void DoSetSize(int x, int y,
96 int width, int height,
97 int sizeFlags = wxSIZE_AUTO);
98
99 virtual void DoSetClientSize(int width, int height);
100
101 private:
102 DECLARE_EVENT_TABLE()
103 };
104
105 #endif
106 // _WX_DIALOG_H_