]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dialog.h
Fix memory leak by letting the base class version handle the
[wxWidgets.git] / include / wx / motif / dialog.h
CommitLineData
9b6dbb09
JS
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
77ffb593 9// Licence: wxWidgets licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DIALOG_H_
13#define _WX_DIALOG_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
83df96d6 16#pragma interface "dialog.h"
9b6dbb09
JS
17#endif
18
7e1bcfa8
MB
19class WXDLLEXPORT wxEventLoop;
20
9b6dbb09 21// Dialog boxes
dfe1eee3 22class WXDLLEXPORT wxDialog : public wxDialogBase
9b6dbb09 23{
83df96d6 24 DECLARE_DYNAMIC_CLASS(wxDialog)
e30285ab 25
9b6dbb09 26public:
bfc6fde4 27 wxDialog();
798a4529 28
bfc6fde4
VZ
29 // Constructor with no modal flag - the new convention.
30 wxDialog(wxWindow *parent, wxWindowID id,
83df96d6
JS
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)
bfc6fde4
VZ
36 {
37 Create(parent, id, title, pos, size, style, name);
38 }
e30285ab 39
bfc6fde4 40 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
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);
e30285ab 46
bfc6fde4 47 ~wxDialog();
e30285ab 48
bfc6fde4 49 virtual bool Destroy();
798a4529
MB
50
51 virtual bool Show(bool show = TRUE);
52
bfc6fde4 53 void SetTitle(const wxString& title);
e30285ab 54
bfc6fde4 55 void SetModal(bool flag);
e30285ab 56
dfe1eee3 57 virtual bool IsModal() const
83df96d6 58 { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
e30285ab 59
bfc6fde4
VZ
60 virtual int ShowModal();
61 virtual void EndModal(int retCode);
e30285ab 62
dfe1eee3
VZ
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; }
e30285ab 69
bfc6fde4
VZ
70 // Standard buttons
71 void OnOK(wxCommandEvent& event);
72 void OnApply(wxCommandEvent& event);
73 void OnCancel(wxCommandEvent& event);
e30285ab 74
bfc6fde4
VZ
75 // Responds to colour changes
76 void OnSysColourChanged(wxSysColourChangedEvent& event);
e30285ab 77
dfe1eee3
VZ
78 void OnCharHook(wxKeyEvent& event);
79 void OnCloseWindow(wxCloseEvent& event);
e30285ab 80
798a4529
MB
81private:
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
bfc6fde4
VZ
90 //// Motif-specific
91 bool m_modalShowing;
7e1bcfa8 92 wxEventLoop* m_eventLoop;
798a4529 93
bfc6fde4
VZ
94protected:
95 virtual void DoSetSize(int x, int y,
83df96d6
JS
96 int width, int height,
97 int sizeFlags = wxSIZE_AUTO);
e30285ab 98
bfc6fde4 99 virtual void DoSetClientSize(int width, int height);
e30285ab 100
bfc6fde4
VZ
101private:
102 DECLARE_EVENT_TABLE()
9b6dbb09
JS
103};
104
105#endif
83df96d6 106// _WX_DIALOG_H_