]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/toplevel.h
Use RIAA wrapper for wxSpinCtrl event disabling in wxGTK.
[wxWidgets.git] / include / wx / gtk / toplevel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/toplevel.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef _WX_GTK_TOPLEVEL_H_
10 #define _WX_GTK_TOPLEVEL_H_
11
12 //-----------------------------------------------------------------------------
13 // wxTopLevelWindowGTK
14 //-----------------------------------------------------------------------------
15
16 class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase
17 {
18 typedef wxTopLevelWindowBase base_type;
19 public:
20 // construction
21 wxTopLevelWindowGTK() { Init(); }
22 wxTopLevelWindowGTK(wxWindow *parent,
23 wxWindowID id,
24 const wxString& title,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = wxDEFAULT_FRAME_STYLE,
28 const wxString& name = wxFrameNameStr)
29 {
30 Init();
31
32 Create(parent, id, title, pos, size, style, name);
33 }
34
35 bool Create(wxWindow *parent,
36 wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE,
41 const wxString& name = wxFrameNameStr);
42
43 virtual ~wxTopLevelWindowGTK();
44
45 // implement base class pure virtuals
46 virtual void Maximize(bool maximize = true);
47 virtual bool IsMaximized() const;
48 virtual void Iconize(bool iconize = true);
49 virtual bool IsIconized() const;
50 virtual void SetIcons(const wxIconBundle& icons);
51 virtual void Restore();
52
53 virtual bool EnableCloseButton(bool enable = true);
54
55 virtual void ShowWithoutActivating();
56 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
57 virtual bool IsFullScreen() const { return m_fsIsShowing; }
58
59 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
60
61 virtual void SetWindowStyleFlag( long style );
62
63 virtual bool Show(bool show = true);
64
65 virtual void Raise();
66
67 virtual bool IsActive();
68
69 virtual void SetTitle( const wxString &title );
70 virtual wxString GetTitle() const { return m_title; }
71
72 virtual void SetLabel(const wxString& label) { SetTitle( label ); }
73 virtual wxString GetLabel() const { return GetTitle(); }
74
75
76 virtual bool SetTransparent(wxByte alpha);
77 virtual bool CanSetTransparent();
78
79 // Experimental, to allow help windows to be
80 // viewable from within modal dialogs
81 virtual void AddGrab();
82 virtual void RemoveGrab();
83 virtual bool IsGrabbed() const { return m_grabbed; }
84
85
86 virtual void Refresh( bool eraseBackground = true,
87 const wxRect *rect = (const wxRect *) NULL );
88
89 // implementation from now on
90 // --------------------------
91
92 // GTK callbacks
93 virtual void OnInternalIdle();
94
95 virtual void GTKHandleRealized();
96
97 // do *not* call this to iconize the frame, this is a private function!
98 void SetIconizeState(bool iconic);
99
100 GtkWidget *m_mainWidget;
101
102 bool m_fsIsShowing; /* full screen */
103 int m_fsSaveGdkFunc, m_fsSaveGdkDecor;
104 wxRect m_fsSaveFrame;
105
106 // m_windowStyle translated to GDK's terms
107 int m_gdkFunc,
108 m_gdkDecor;
109
110 // size of WM decorations
111 wxSize m_decorSize;
112
113 // private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
114 // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
115 int m_urgency_hint;
116 // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling
117 unsigned m_netFrameExtentsTimerId;
118
119 // return the size of the window without WM decorations
120 void GTKDoGetSize(int *width, int *height) const;
121
122 void GTKUpdateDecorSize(const wxSize& decorSize);
123
124 protected:
125 // give hints to the Window Manager for how the size
126 // of the TLW can be changed by dragging
127 virtual void DoSetSizeHints( int minW, int minH,
128 int maxW, int maxH,
129 int incW, int incH);
130 // move the window to the specified location and resize it
131 virtual void DoMoveWindow(int x, int y, int width, int height);
132
133 // take into account WM decorations here
134 virtual void DoSetSize(int x, int y,
135 int width, int height,
136 int sizeFlags = wxSIZE_AUTO);
137
138 virtual void DoSetClientSize(int width, int height);
139 virtual void DoGetClientSize(int *width, int *height) const;
140
141 // string shown in the title bar
142 wxString m_title;
143
144 bool m_deferShow;
145
146 private:
147 void Init();
148 wxSize& GetCachedDecorSize();
149
150 // size hint increments
151 int m_incWidth, m_incHeight;
152
153 // is the frame currently iconized?
154 bool m_isIconized;
155
156 // is the frame currently grabbed explicitly by the application?
157 bool m_grabbed;
158
159 bool m_updateDecorSize;
160 bool m_deferShowAllowed;
161 };
162
163 #endif // _WX_GTK_TOPLEVEL_H_