]>
Commit | Line | Data |
---|---|---|
7d9f12f3 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/gtk/toplevel.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
7d9f12f3 | 5 | // Copyright: (c) 1998 Robert Roebling, Julian Smart |
65571936 | 6 | // Licence: wxWindows licence |
7d9f12f3 VS |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
b5e31cc8 PC |
9 | #ifndef _WX_GTK_TOPLEVEL_H_ |
10 | #define _WX_GTK_TOPLEVEL_H_ | |
7d9f12f3 | 11 | |
7d9f12f3 VS |
12 | //----------------------------------------------------------------------------- |
13 | // wxTopLevelWindowGTK | |
14 | //----------------------------------------------------------------------------- | |
15 | ||
20123d49 | 16 | class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase |
7d9f12f3 | 17 | { |
3c7620f6 | 18 | typedef wxTopLevelWindowBase base_type; |
7d9f12f3 VS |
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 | |
cb8cc250 | 46 | virtual void Maximize(bool maximize = true); |
7d9f12f3 | 47 | virtual bool IsMaximized() const; |
cb8cc250 | 48 | virtual void Iconize(bool iconize = true); |
7d9f12f3 | 49 | virtual bool IsIconized() const; |
f618020a | 50 | virtual void SetIcons(const wxIconBundle& icons); |
7d9f12f3 VS |
51 | virtual void Restore(); |
52 | ||
0d635035 RR |
53 | virtual bool EnableCloseButton(bool enable = true); |
54 | ||
dbc7ceb9 | 55 | virtual void ShowWithoutActivating(); |
7d9f12f3 | 56 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
6dd0883d | 57 | virtual bool IsFullScreen() const { return m_fsIsShowing; } |
7d9f12f3 | 58 | |
dca92ddf MR |
59 | virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); |
60 | ||
015dca24 MR |
61 | virtual void SetWindowStyleFlag( long style ); |
62 | ||
cb8cc250 | 63 | virtual bool Show(bool show = true); |
7d9f12f3 | 64 | |
a2ac55f5 RR |
65 | virtual void Raise(); |
66 | ||
6b30a44e | 67 | virtual bool IsActive(); |
35ff90a0 | 68 | |
7d9f12f3 VS |
69 | virtual void SetTitle( const wxString &title ); |
70 | virtual wxString GetTitle() const { return m_title; } | |
71 | ||
a03b38ef RR |
72 | virtual void SetLabel(const wxString& label) { SetTitle( label ); } |
73 | virtual wxString GetLabel() const { return GetTitle(); } | |
74 | ||
75 | ||
07e49707 MR |
76 | virtual bool SetTransparent(wxByte alpha); |
77 | virtual bool CanSetTransparent(); | |
78 | ||
5152b0e5 JS |
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 | ||
d0285203 RR |
85 | |
86 | virtual void Refresh( bool eraseBackground = true, | |
87 | const wxRect *rect = (const wxRect *) NULL ); | |
88 | ||
7d9f12f3 VS |
89 | // implementation from now on |
90 | // -------------------------- | |
91 | ||
7d9f12f3 | 92 | // GTK callbacks |
7d9f12f3 VS |
93 | virtual void OnInternalIdle(); |
94 | ||
612515af VZ |
95 | virtual void GTKHandleRealized(); |
96 | ||
c37b0f09 PC |
97 | void GTKConfigureEvent(int x, int y); |
98 | ||
7d9f12f3 VS |
99 | // do *not* call this to iconize the frame, this is a private function! |
100 | void SetIconizeState(bool iconic); | |
101 | ||
7d9f12f3 | 102 | GtkWidget *m_mainWidget; |
7d9f12f3 VS |
103 | |
104 | bool m_fsIsShowing; /* full screen */ | |
290cd301 | 105 | int m_fsSaveGdkFunc, m_fsSaveGdkDecor; |
7d9f12f3 | 106 | wxRect m_fsSaveFrame; |
6aeb6f2a VZ |
107 | |
108 | // m_windowStyle translated to GDK's terms | |
290cd301 | 109 | int m_gdkFunc, |
6aeb6f2a | 110 | m_gdkDecor; |
7d9f12f3 | 111 | |
0ab0d0e1 | 112 | // size of WM decorations |
c37b0f09 PC |
113 | struct DecorSize |
114 | { | |
115 | int left, right, top, bottom; | |
116 | }; | |
117 | DecorSize m_decorSize; | |
0ab0d0e1 | 118 | |
ef1a9be4 MR |
119 | // private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and |
120 | // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle. | |
121 | int m_urgency_hint; | |
f5c0761f PC |
122 | // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling |
123 | unsigned m_netFrameExtentsTimerId; | |
ef1a9be4 | 124 | |
290cd301 | 125 | // return the size of the window without WM decorations |
6e264997 VZ |
126 | void GTKDoGetSize(int *width, int *height) const; |
127 | ||
c37b0f09 | 128 | void GTKUpdateDecorSize(const DecorSize& decorSize); |
81b0235f | 129 | |
7d9f12f3 | 130 | protected: |
b2e10dac PC |
131 | // give hints to the Window Manager for how the size |
132 | // of the TLW can be changed by dragging | |
133 | virtual void DoSetSizeHints( int minW, int minH, | |
134 | int maxW, int maxH, | |
135 | int incW, int incH); | |
949ff63e | 136 | // move the window to the specified location and resize it |
6f02a879 VZ |
137 | virtual void DoMoveWindow(int x, int y, int width, int height); |
138 | ||
a6cdd521 | 139 | // take into account WM decorations here |
7d9f12f3 VS |
140 | virtual void DoSetSize(int x, int y, |
141 | int width, int height, | |
142 | int sizeFlags = wxSIZE_AUTO); | |
a6cdd521 | 143 | |
428f841b | 144 | virtual void DoSetClientSize(int width, int height); |
a6cdd521 VZ |
145 | virtual void DoGetClientSize(int *width, int *height) const; |
146 | ||
a6cdd521 VZ |
147 | // string shown in the title bar |
148 | wxString m_title; | |
cb8cc250 | 149 | |
11d8dfd2 PC |
150 | bool m_deferShow; |
151 | ||
cca410b3 | 152 | private: |
95dc31e0 | 153 | void Init(); |
c37b0f09 | 154 | DecorSize& GetCachedDecorSize(); |
fce611e4 | 155 | |
8f71e657 PC |
156 | // size hint increments |
157 | int m_incWidth, m_incHeight; | |
158 | ||
7d9f12f3 VS |
159 | // is the frame currently iconized? |
160 | bool m_isIconized; | |
a6cdd521 VZ |
161 | |
162 | // is the frame currently grabbed explicitly by the application? | |
5152b0e5 | 163 | bool m_grabbed; |
11d8dfd2 PC |
164 | |
165 | bool m_updateDecorSize; | |
6089c4c8 | 166 | bool m_deferShowAllowed; |
7d9f12f3 VS |
167 | }; |
168 | ||
b5e31cc8 | 169 | #endif // _WX_GTK_TOPLEVEL_H_ |