1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/toplevel.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_GTK_TOPLEVEL_H_
10 #define _WX_GTK_TOPLEVEL_H_
12 //-----------------------------------------------------------------------------
13 // wxTopLevelWindowGTK
14 //-----------------------------------------------------------------------------
16 class WXDLLIMPEXP_CORE wxTopLevelWindowGTK
: public wxTopLevelWindowBase
18 typedef wxTopLevelWindowBase base_type
;
21 wxTopLevelWindowGTK() { Init(); }
22 wxTopLevelWindowGTK(wxWindow
*parent
,
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
)
32 Create(parent
, id
, title
, pos
, size
, style
, name
);
35 bool Create(wxWindow
*parent
,
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
);
43 virtual ~wxTopLevelWindowGTK();
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();
53 virtual bool EnableCloseButton(bool enable
= true);
55 virtual void ShowWithoutActivating();
56 virtual bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
);
57 virtual bool IsFullScreen() const { return m_fsIsShowing
; }
59 virtual void RequestUserAttention(int flags
= wxUSER_ATTENTION_INFO
);
61 virtual void SetWindowStyleFlag( long style
);
63 virtual bool Show(bool show
= true);
67 virtual bool IsActive();
69 virtual void SetTitle( const wxString
&title
);
70 virtual wxString
GetTitle() const { return m_title
; }
72 virtual void SetLabel(const wxString
& label
) { SetTitle( label
); }
73 virtual wxString
GetLabel() const { return GetTitle(); }
76 virtual bool SetTransparent(wxByte alpha
);
77 virtual bool CanSetTransparent();
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
; }
86 virtual void Refresh( bool eraseBackground
= true,
87 const wxRect
*rect
= (const wxRect
*) NULL
);
89 // implementation from now on
90 // --------------------------
93 virtual void OnInternalIdle();
95 virtual void GTKHandleRealized();
97 void GTKConfigureEvent(int x
, int y
);
99 // do *not* call this to iconize the frame, this is a private function!
100 void SetIconizeState(bool iconic
);
102 GtkWidget
*m_mainWidget
;
104 bool m_fsIsShowing
; /* full screen */
105 int m_fsSaveGdkFunc
, m_fsSaveGdkDecor
;
106 wxRect m_fsSaveFrame
;
108 // m_windowStyle translated to GDK's terms
112 // size of WM decorations
115 int left
, right
, top
, bottom
;
117 DecorSize m_decorSize
;
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.
122 // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling
123 unsigned m_netFrameExtentsTimerId
;
125 // return the size of the window without WM decorations
126 void GTKDoGetSize(int *width
, int *height
) const;
128 void GTKUpdateDecorSize(const DecorSize
& decorSize
);
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
,
136 // move the window to the specified location and resize it
137 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
139 // take into account WM decorations here
140 virtual void DoSetSize(int x
, int y
,
141 int width
, int height
,
142 int sizeFlags
= wxSIZE_AUTO
);
144 virtual void DoSetClientSize(int width
, int height
);
145 virtual void DoGetClientSize(int *width
, int *height
) const;
147 // string shown in the title bar
154 DecorSize
& GetCachedDecorSize();
156 // size hint increments
157 int m_incWidth
, m_incHeight
;
159 // is the frame currently iconized?
162 // is the frame currently grabbed explicitly by the application?
165 bool m_updateDecorSize
;
166 bool m_deferShowAllowed
;
169 #endif // _WX_GTK_TOPLEVEL_H_