]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/toplevel.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 #pragma implementation "toplevel.h"
22 // For compilers that support precompilation, includes "wx.h".
23 #include "wx/wxprec.h"
30 #include "wx/toplevel.h"
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 extern int g_openDialogs
;
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 #ifndef __WXUNIVERSAL__
44 IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow
, wxWindow
)
48 // ============================================================================
50 // ============================================================================
52 void wxTopLevelWindowMGL::Init()
56 m_isMaximized
= FALSE
;
57 m_fsIsShowing
= FALSE
;
61 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
63 const wxString
& title
,
65 const wxSize
& sizeOrig
,
69 // always create a frame of some reasonable, even if arbitrary, size (at
70 // least for MSW compatibility)
71 wxSize size
= sizeOrig
;
72 if ( size
.x
== -1 || size
.y
== -1 )
74 wxSize sizeDpy
= wxGetDisplaySize();
76 size
.x
= sizeDpy
.x
/ 3;
78 size
.y
= sizeDpy
.y
/ 5;
81 wxWindow::Create(NULL
, id
, pos
, sizeOrig
, style
, name
);
84 parent
->AddChild(this);
86 wxTopLevelWindows
.Append(this);
93 wxTopLevelWindowMGL::~wxTopLevelWindowMGL()
95 m_isBeingDeleted
= TRUE
;
97 wxTopLevelWindows
.DeleteObject(this);
99 if (wxTheApp
->GetTopWindow() == this)
100 wxTheApp
->SetTopWindow(NULL
);
102 if ((wxTopLevelWindows
.Number() == 0) &&
103 (wxTheApp
->GetExitOnFrameDelete()))
105 wxTheApp
->ExitMainLoop();
109 bool wxTopLevelWindowMGL::ShowFullScreen(bool show
, long style
)
111 if (show
== m_fsIsShowing
) return FALSE
; // return what?
113 m_fsIsShowing
= show
;
117 m_fsSaveStyle
= m_windowStyle
;
118 m_fsSaveFlag
= style
;
119 GetPosition(&m_fsSaveFrame
.x
, &m_fsSaveFrame
.y
);
120 GetSize(&m_fsSaveFrame
.width
, &m_fsSaveFrame
.height
);
122 if ( style
& wxFULLSCREEN_NOCAPTION
)
123 m_windowStyle
&= ~wxCAPTION
;
124 if ( style
& wxFULLSCREEN_NOBORDER
)
125 m_windowStyle
= wxSIMPLE_BORDER
;
128 wxDisplaySize(&x
, &y
);
133 m_windowStyle
= m_fsSaveStyle
;
134 SetSize(m_fsSaveFrame
.x
, m_fsSaveFrame
.y
,
135 m_fsSaveFrame
.width
, m_fsSaveFrame
.height
);
141 bool wxTopLevelWindowMGL::Show(bool show
)
143 bool ret
= wxTopLevelWindowBase::Show(show
);
145 // If this is the first time Show was called, send size event,
146 // so that the frame can adjust itself (think auto layout or single child)
150 wxSizeEvent
event(GetSize(), GetId());
151 event
.SetEventObject(this);
152 GetEventHandler()->ProcessEvent(event
);
155 if ( ret
&& show
&& AcceptsFocus() )
157 // FIXME_MGL -- don't do this for popup windows?
161 void wxTopLevelWindowMGL::Maximize(bool maximize
)
163 if ( maximize
&& !m_isMaximized
)
167 m_isMaximized
= TRUE
;
169 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
170 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
172 wxClientDisplayRect(&x
, &y
, &w
, &h
);
175 else if ( !maximize
&& m_isMaximized
)
177 m_isMaximized
= FALSE
;
178 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
179 m_savedFrame
.width
, m_savedFrame
.height
);
183 bool wxTopLevelWindowMGL::IsMaximized() const
185 return m_isMaximized
;
188 void wxTopLevelWindowMGL::Restore()
200 void wxTopLevelWindowMGL::Iconize(bool iconize
)
202 // FIXME_MGL - use wxDesktop for this
205 bool wxTopLevelWindowMGL::IsIconized() const