]>
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);
92 wxTopLevelWindowMGL::~wxTopLevelWindowMGL()
94 m_isBeingDeleted
= TRUE
;
96 wxTopLevelWindows
.DeleteObject(this);
98 if (wxTheApp
->GetTopWindow() == this)
99 wxTheApp
->SetTopWindow(NULL
);
101 if ((wxTopLevelWindows
.Number() == 0) &&
102 (wxTheApp
->GetExitOnFrameDelete()))
104 wxTheApp
->ExitMainLoop();
108 bool wxTopLevelWindowMGL::ShowFullScreen(bool show
, long style
)
110 if (show
== m_fsIsShowing
) return FALSE
; // return what?
112 m_fsIsShowing
= show
;
116 m_fsSaveStyle
= m_windowStyle
;
117 m_fsSaveFlag
= style
;
118 GetPosition(&m_fsSaveFrame
.x
, &m_fsSaveFrame
.y
);
119 GetSize(&m_fsSaveFrame
.width
, &m_fsSaveFrame
.height
);
121 if ( style
& wxFULLSCREEN_NOCAPTION
)
122 m_windowStyle
&= ~wxCAPTION
;
123 if ( style
& wxFULLSCREEN_NOBORDER
)
124 m_windowStyle
= wxSIMPLE_BORDER
;
127 wxDisplaySize(&x
, &y
);
132 m_windowStyle
= m_fsSaveStyle
;
133 SetSize(m_fsSaveFrame
.x
, m_fsSaveFrame
.y
,
134 m_fsSaveFrame
.width
, m_fsSaveFrame
.height
);
140 bool wxTopLevelWindowMGL::Show(bool show
)
142 bool ret
= wxTopLevelWindowBase::Show(show
);
144 // If this is the first time Show was called, send size event,
145 // so that the frame can adjust itself (think auto layout or single child)
149 wxSizeEvent
event(GetSize(), GetId());
150 event
.SetEventObject(this);
151 GetEventHandler()->ProcessEvent(event
);
154 if ( ret
&& show
&& AcceptsFocus() )
156 // FIXME_MGL -- don't do this for popup windows?
160 void wxTopLevelWindowMGL::Maximize(bool maximize
)
162 if ( maximize
&& !m_isMaximized
)
166 m_isMaximized
= TRUE
;
168 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
169 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
171 wxClientDisplayRect(&x
, &y
, &w
, &h
);
174 else if ( !maximize
&& m_isMaximized
)
176 m_isMaximized
= FALSE
;
177 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
178 m_savedFrame
.width
, m_savedFrame
.height
);
182 bool wxTopLevelWindowMGL::IsMaximized() const
184 return m_isMaximized
;
187 void wxTopLevelWindowMGL::Restore()
199 void wxTopLevelWindowMGL::Iconize(bool WXUNUSED(iconize
))
201 wxFAIL_MSG(wxT("Iconize not supported under wxMGL"));
202 // FIXME_MGL - Iconize is not supported in fullscreen mode.
203 // It will be supported in windowed mode (if ever implemented in MGL...)
206 bool wxTopLevelWindowMGL::IsIconized() const