]>
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
;
60 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
62 const wxString
& title
,
64 const wxSize
& sizeOrig
,
68 // always create a frame of some reasonable, even if arbitrary, size (at
69 // least for MSW compatibility)
70 wxSize size
= sizeOrig
;
71 if ( size
.x
== -1 || size
.y
== -1 )
73 wxSize sizeDpy
= wxGetDisplaySize();
75 size
.x
= sizeDpy
.x
/ 3;
77 size
.y
= sizeDpy
.y
/ 5;
80 wxWindow::Create(NULL
, id
, pos
, sizeOrig
, style
, name
);
83 parent
->AddChild(this);
85 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
);
143 if ( ret
&& show
&& AcceptsFocus() )
145 // FIXME_MGL -- don't do this for popup windows?
149 void wxTopLevelWindowMGL::Maximize(bool maximize
)
151 if ( maximize
&& !m_isMaximized
)
155 m_isMaximized
= TRUE
;
157 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
158 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
160 wxClientDisplayRect(&x
, &y
, &w
, &h
);
163 else if ( !maximize
&& m_isMaximized
)
165 m_isMaximized
= FALSE
;
166 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
167 m_savedFrame
.width
, m_savedFrame
.height
);
171 bool wxTopLevelWindowMGL::IsMaximized() const
173 return m_isMaximized
;
176 void wxTopLevelWindowMGL::Restore()
188 void wxTopLevelWindowMGL::Iconize(bool iconize
)
190 // FIXME_MGL - use wxDesktop for this
193 bool wxTopLevelWindowMGL::IsIconized() const