| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: dialog.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Created: |
| 6 | // Id: $Id$ |
| 7 | // Copyright: (c) 1998 Robert Roebling |
| 8 | // Licence: wxWindows licence |
| 9 | ///////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | #ifndef __GTKDIALOGH__ |
| 12 | #define __GTKDIALOGH__ |
| 13 | |
| 14 | #ifdef __GNUG__ |
| 15 | #pragma interface |
| 16 | #endif |
| 17 | |
| 18 | #include "wx/defs.h" |
| 19 | #include "wx/panel.h" |
| 20 | #include "wx/icon.h" |
| 21 | |
| 22 | //----------------------------------------------------------------------------- |
| 23 | // classes |
| 24 | //----------------------------------------------------------------------------- |
| 25 | |
| 26 | class wxDialog; |
| 27 | |
| 28 | //----------------------------------------------------------------------------- |
| 29 | // global data |
| 30 | //----------------------------------------------------------------------------- |
| 31 | |
| 32 | extern const wxChar *wxDialogNameStr; |
| 33 | |
| 34 | //----------------------------------------------------------------------------- |
| 35 | // wxDialog |
| 36 | //----------------------------------------------------------------------------- |
| 37 | |
| 38 | class wxDialog: public wxPanel |
| 39 | { |
| 40 | DECLARE_DYNAMIC_CLASS(wxDialog) |
| 41 | |
| 42 | public: |
| 43 | wxDialog() { Init(); } |
| 44 | wxDialog( wxWindow *parent, wxWindowID id, |
| 45 | const wxString &title, |
| 46 | const wxPoint &pos = wxDefaultPosition, |
| 47 | const wxSize &size = wxDefaultSize, |
| 48 | long style = wxDEFAULT_DIALOG_STYLE, |
| 49 | const wxString &name = wxDialogNameStr ); |
| 50 | bool Create( wxWindow *parent, wxWindowID id, |
| 51 | const wxString &title, |
| 52 | const wxPoint &pos = wxDefaultPosition, |
| 53 | const wxSize &size = wxDefaultSize, |
| 54 | long style = wxDEFAULT_DIALOG_STYLE, |
| 55 | const wxString &name = wxDialogNameStr ); |
| 56 | ~wxDialog(); |
| 57 | |
| 58 | void SetTitle(const wxString& title); |
| 59 | wxString GetTitle() const; |
| 60 | |
| 61 | void OnApply( wxCommandEvent &event ); |
| 62 | void OnCancel( wxCommandEvent &event ); |
| 63 | void OnOK( wxCommandEvent &event ); |
| 64 | void OnPaint( wxPaintEvent& event ); |
| 65 | void OnSize( wxSizeEvent &event ); |
| 66 | void OnCloseWindow( wxCloseEvent& event ); |
| 67 | /* |
| 68 | void OnCharHook( wxKeyEvent& event ); |
| 69 | */ |
| 70 | |
| 71 | bool Destroy(); |
| 72 | |
| 73 | virtual bool Show( bool show ); |
| 74 | virtual int ShowModal(); |
| 75 | virtual void EndModal( int retCode ); |
| 76 | virtual bool IsModal() const; |
| 77 | void SetModal( bool modal ); |
| 78 | |
| 79 | virtual void InitDialog(void); |
| 80 | |
| 81 | virtual void Centre( int direction = wxHORIZONTAL ); |
| 82 | |
| 83 | virtual void SetIcon( const wxIcon &icon ); |
| 84 | virtual void Iconize( bool WXUNUSED(iconize)) { } |
| 85 | virtual bool IsIconized() const { return FALSE; } |
| 86 | bool Iconized() const { return IsIconized(); } |
| 87 | virtual void Maximize() { } |
| 88 | virtual void Restore() { } |
| 89 | |
| 90 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } |
| 91 | int GetReturnCode() const { return m_returnCode; } |
| 92 | |
| 93 | // implementation |
| 94 | |
| 95 | virtual void GtkOnSize( int x, int y, int width, int height ); |
| 96 | virtual void OnInternalIdle(); |
| 97 | |
| 98 | bool m_modalShowing; |
| 99 | wxString m_title; |
| 100 | wxIcon m_icon; |
| 101 | |
| 102 | protected: |
| 103 | // common part of all ctors |
| 104 | void Init(); |
| 105 | |
| 106 | virtual void DoSetSize(int x, int y, |
| 107 | int width, int height, |
| 108 | int sizeFlags = wxSIZE_AUTO); |
| 109 | |
| 110 | private: |
| 111 | int m_returnCode; |
| 112 | |
| 113 | DECLARE_EVENT_TABLE() |
| 114 | }; |
| 115 | |
| 116 | #endif // __GTKDIALOGH__ |