| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/palmos/toplevel.h |
| 3 | // Purpose: wxTopLevelWindow |
| 4 | // Author: William Osborne - minimal working wxPalmOS port |
| 5 | // Modified by: Wlodzimierz ABX Skiba - more than minimal functionality |
| 6 | // Created: 10/13/04 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
| 9 | // Licence: wxWindows licence |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_PALMOS_TOPLEVEL_H_ |
| 13 | #define _WX_PALMOS_TOPLEVEL_H_ |
| 14 | |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | // wxTopLevelWindowPalm |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | |
| 19 | class WXDLLIMPEXP_CORE wxTopLevelWindowPalm : public wxTopLevelWindowBase |
| 20 | { |
| 21 | public: |
| 22 | // constructors and such |
| 23 | wxTopLevelWindowPalm() { Init(); } |
| 24 | |
| 25 | wxTopLevelWindowPalm(wxWindow *parent, |
| 26 | wxWindowID id, |
| 27 | const wxString& title, |
| 28 | const wxPoint& pos = wxDefaultPosition, |
| 29 | const wxSize& size = wxDefaultSize, |
| 30 | long style = wxDEFAULT_FRAME_STYLE, |
| 31 | const wxString& name = wxFrameNameStr) |
| 32 | { |
| 33 | Init(); |
| 34 | |
| 35 | (void)Create(parent, id, title, pos, size, style, name); |
| 36 | } |
| 37 | |
| 38 | bool Create(wxWindow *parent, |
| 39 | wxWindowID id, |
| 40 | const wxString& title, |
| 41 | const wxPoint& pos = wxDefaultPosition, |
| 42 | const wxSize& size = wxDefaultSize, |
| 43 | long style = wxDEFAULT_FRAME_STYLE, |
| 44 | const wxString& name = wxFrameNameStr); |
| 45 | |
| 46 | virtual ~wxTopLevelWindowPalm(); |
| 47 | |
| 48 | // implement base class pure virtuals |
| 49 | |
| 50 | virtual void SetTitle( const wxString& title); |
| 51 | virtual wxString GetTitle() const; |
| 52 | |
| 53 | virtual void Maximize(bool maximize = true); |
| 54 | virtual bool IsMaximized() const; |
| 55 | virtual void Iconize(bool iconize = true); |
| 56 | virtual bool IsIconized() const; |
| 57 | virtual void SetIcons(const wxIconBundle& icons); |
| 58 | virtual void Restore(); |
| 59 | |
| 60 | #ifndef __WXWINCE__ |
| 61 | virtual bool SetShape(const wxRegion& region); |
| 62 | #endif // __WXWINCE__ |
| 63 | |
| 64 | virtual bool Show(bool show = true); |
| 65 | |
| 66 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
| 67 | virtual bool IsFullScreen() const { return m_fsIsShowing; } |
| 68 | |
| 69 | // wxPalm only: EnableCloseButton(false) may be used to remove the "Close" |
| 70 | // button from the title bar |
| 71 | bool EnableCloseButton(bool enable = true); |
| 72 | |
| 73 | // implementation from now on |
| 74 | // -------------------------- |
| 75 | |
| 76 | // event handlers |
| 77 | void OnActivate(wxActivateEvent& event); |
| 78 | |
| 79 | // called by wxWindow whenever it gets focus |
| 80 | void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } |
| 81 | wxWindow *GetLastFocus() const { return m_winLastFocused; } |
| 82 | |
| 83 | // interface to native frame structure |
| 84 | WXFORMPTR GetForm() const; |
| 85 | |
| 86 | // handle native events |
| 87 | bool HandleControlSelect(WXEVENTPTR event); |
| 88 | bool HandleControlRepeat(WXEVENTPTR event); |
| 89 | bool HandleSize(WXEVENTPTR event); |
| 90 | |
| 91 | virtual WXWINHANDLE GetWinHandle() const; |
| 92 | |
| 93 | protected: |
| 94 | // common part of all ctors |
| 95 | void Init(); |
| 96 | |
| 97 | // getting and setting sizes |
| 98 | virtual void DoGetSize( int *width, int *height ) const; |
| 99 | |
| 100 | // common part of Iconize(), Maximize() and Restore() |
| 101 | void DoShowWindow(int nShowCmd); |
| 102 | |
| 103 | // translate wxWidgets flags to Windows ones |
| 104 | virtual WXDWORD PalmGetStyle(long flags, WXDWORD *exstyle) const; |
| 105 | |
| 106 | // is the window currently iconized? |
| 107 | bool m_iconized; |
| 108 | |
| 109 | // should the frame be maximized when it will be shown? set by Maximize() |
| 110 | // when it is called while the frame is hidden |
| 111 | bool m_maximizeOnShow; |
| 112 | |
| 113 | // Data to save/restore when calling ShowFullScreen |
| 114 | long m_fsStyle; // Passed to ShowFullScreen |
| 115 | wxRect m_fsOldSize; |
| 116 | long m_fsOldWindowStyle; |
| 117 | bool m_fsIsMaximized; |
| 118 | bool m_fsIsShowing; |
| 119 | |
| 120 | // the last focused child: we restore focus to it on activation |
| 121 | wxWindow *m_winLastFocused; |
| 122 | |
| 123 | DECLARE_EVENT_TABLE() |
| 124 | DECLARE_NO_COPY_CLASS(wxTopLevelWindowPalm) |
| 125 | }; |
| 126 | |
| 127 | #endif // _WX_PALMOS_TOPLEVEL_H_ |