]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/toplevel.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
19 #pragma implementation "toplevel.h"
22 // For compilers that support precompilation, includes "wx.h".
23 #include "wx/wxprec.h"
30 #include "wx/toplevel.h"
32 #include "wx/mgl/private.h"
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 extern int g_openDialogs
;
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 #ifndef __WXUNIVERSAL__
45 IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow
, wxWindow
)
49 // ============================================================================
51 // ============================================================================
53 void wxTopLevelWindowMGL::Init()
57 m_isMaximized
= FALSE
;
58 m_fsIsShowing
= FALSE
;
62 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
64 const wxString
& title
,
66 const wxSize
& sizeOrig
,
70 // always create a frame of some reasonable, even if arbitrary, size (at
71 // least for MSW compatibility)
72 wxSize size
= sizeOrig
;
73 if ( size
.x
== -1 || size
.y
== -1 )
75 wxSize sizeDpy
= wxGetDisplaySize();
77 size
.x
= sizeDpy
.x
/ 3;
79 size
.y
= sizeDpy
.y
/ 5;
82 wxWindow::Create(NULL
, id
, pos
, sizeOrig
, style
, name
);
85 parent
->AddChild(this);
87 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
)
164 wxClientDisplayRect(&x
, &y
, &w
, &h
);
166 rect_t screenRect
= MGL_defRect(x
, y
, w
, h
);
167 MGL_wmInvalidateRect(g_winMng
, &screenRect
);
169 if ( maximize
&& !m_isMaximized
)
171 m_isMaximized
= TRUE
;
173 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
174 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
178 else if ( !maximize
&& m_isMaximized
)
180 m_isMaximized
= FALSE
;
181 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
182 m_savedFrame
.width
, m_savedFrame
.height
);
186 bool wxTopLevelWindowMGL::IsMaximized() const
188 return m_isMaximized
;
191 void wxTopLevelWindowMGL::Restore()
203 void wxTopLevelWindowMGL::Iconize(bool WXUNUSED(iconize
))
205 wxFAIL_MSG(wxT("Iconize not supported under wxMGL"));
206 // FIXME_MGL - Iconize is not supported in fullscreen mode.
207 // It will be supported in windowed mode (if ever implemented in MGL...)
210 bool wxTopLevelWindowMGL::IsIconized() const