Returns \true if the window is maximized.
+\membersection{wxTopLevelWindow::IsUsingNativeDecorations}{wxtoplevelwindowisusingnativedecorations}
+
+\constfunc{bool}{IsUsingNativeDecorations}{\void}
+
+\bftt{This method is specific to wxUniversal port}
+
+Returns \true if this window is using native decorations, \false if we draw
+them ourselves.
+
+\wxheading{See also}
+
+\helpref{UseNativeDecorations}{wxtoplevelwindowusenativedecorations},\\
+\helpref{UseNativeDecorationsByDefault}{wxtoplevelwindowusenativedecorationsbydefault}
+
+
\membersection{wxTopLevelWindow::Maximize}\label{wxtoplevelwindowmaximize}
\func{void}{Maximize}{\param{bool }{maximize}}
\wxheading{See also}
\helpref{wxTopLevelWindow::IsFullScreen}{wxtoplevelwindowisfullscreen}
+
+
+\membersection{wxTopLevelWindow::UseNativeDecorations}\label{wxtoplevelwindowusenativedecorations}
+
+\func{void}{UseNativeDecorations}{\param{bool }{native = \true}}
+
+\bftt{This method is specific to wxUniversal port}
+
+Use native or custom-drawn decorations for this window only. Notice that to
+have any effect this method must be called before really creating the window,
+i.e. two step creation must be used:
+\begin{verbatim}
+ MyFrame *frame = new MyFrame; // use default ctor
+ frame->UseNativeDecorations(false); // change from default "true"
+ frame->Create(parent, title, ...); // really create the frame
+\end{verbatim}
+
+\wxheading{See also}
+
+\helpref{UseNativeDecorationsByDefault}{wxtoplevelwindowusenativedecorationsbydefault},\\
+\helpref{IsUsingNativeDecorations}{wxtoplevelwindowisusingnativedecorations}
+
+
+\membersection{wxTopLevelWindow::UseNativeDecorationsByDefault}\label{wxtoplevelwindowusenativedecorationsbydefault}
+
+\func{void}{UseNativeDecorationsByDefault}{\param{bool }{native = \true}}
+
+\bftt{This method is specific to wxUniversal port}
+
+Top level windows in wxUniversal port can use either system-provided window
+decorations (i.e. title bar and various icons, buttons and menus in it) or draw
+the decorations themselves. By default the system decorations are used if they
+are available, but this method can be called with \arg{native} set to \false to
+change this for all windows created after this point.
+
+Also note that if \texttt{WXDECOR} environment variable is set, then custom
+decorations are used by default and so it may make sense to call this method
+with default argument if the application can't use custom decorations at all
+for some reason.
+
+\wxheading{See also}
+
+\helpref{UseNativeDecorations}{wxtoplevelwindowusenativedecorations}
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
+ // wxUniv-specific methods: do [not] use native decorations for this (or
+ // all) window(s)
+ //
+ // notice that this has no effect if the system doesn't support any native
+ // decorations anyhow and that by default native decorations are used
+ //
+ // if UseNativeDecorations() is used, it must be called before Create()
+ static UseNativeDecorationsByDefault(bool native = true);
+ void UseNativeDecorations(bool native = true);
+ bool IsUsingNativeDecorations() const;
+
+
// implement base class pure virtuals
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual wxPoint GetClientAreaOrigin() const;
static int ms_drawDecorations;
// true if wxTLW can be iconized
static int ms_canIconize;
+
+ // true if we're using native decorations
+ bool m_usingNativeDecorations;
// true for currently active frame
- bool m_isActive:1;
+ bool m_isActive;
// version of icon for titlebar (16x16)
wxIcon m_titlebarIcon;
// saved window style in fullscreen mdoe
void wxTopLevelWindow::Init()
{
+ // once-only ms_drawDecorations initialization
+ if ( ms_drawDecorations == -1 )
+ {
+ ms_drawDecorations =
+ !wxSystemSettings::HasFeature(wxSYS_CAN_DRAW_FRAME_DECORATIONS) ||
+ wxGetEnv(wxT("WXDECOR"), NULL);
+ }
+
+ m_usingNativeDecorations = ms_drawDecorations == 0;
m_isActive = false;
m_windowStyle = 0;
m_pressedButton = 0;
long styleOrig = 0,
exstyleOrig = 0;
- if ( ms_drawDecorations == -1 )
- {
- ms_drawDecorations =
- !wxSystemSettings::HasFeature(wxSYS_CAN_DRAW_FRAME_DECORATIONS)
- || wxGetEnv(wxT("WXDECOR"), NULL);
- // FIXME -- wxUniv should provide a way to force non-native decorations!
- // $WXDECOR is just a hack in absence of better wxUniv solution
- }
-
- if ( ms_canIconize == -1 )
- {
- ms_canIconize = wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME);
- }
-
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
CreateInputHandler(wxINP_HANDLER_TOPLEVEL);
style &= ~(wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxSYSTEM_MENU | wxRESIZE_BORDER | wxFRAME_TOOL_WINDOW |
wxRESIZE_BORDER);
- style |= wxSIMPLE_BORDER;
+ style |= wxBORDER_NONE;
SetExtraStyle(exstyleOrig & ~wxWS_EX_CONTEXTHELP);
}
size, style, name) )
return false;
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
m_windowStyle = styleOrig;
m_exStyle = exstyleOrig;
{
if ( show == IsFullScreen() ) return false;
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
if ( show )
{
return wxTopLevelWindowNative::ShowFullScreen(show, style);
}
+/* static */ wxTopLevelWindow::UseNativeDecorationsByDefault(bool native)
+{
+ ms_drawDecorations = !native;
+}
+
+void wxTopLevelWindow::UseNativeDecorations(bool native)
+{
+ wxASSERT_MSG( !m_windowStyle, _T("must be called before Create()") );
+
+ m_usingNativeDecorations = native;
+}
+
+bool wxTopLevelWindow::IsUsingNativeDecorations() const
+{
+ return m_usingNativeDecorations;
+}
+
long wxTopLevelWindow::GetDecorationsStyle() const
{
long style = 0;
if ( m_windowStyle & wxCAPTION )
{
+ if ( ms_canIconize == -1 )
+ {
+ ms_canIconize = wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME);
+ }
+
style |= wxTOPLEVEL_TITLEBAR | wxTOPLEVEL_BUTTON_CLOSE;
if ( (m_windowStyle & wxMINIMIZE_BOX) && ms_canIconize )
style |= wxTOPLEVEL_BUTTON_ICONIZE;
wxPoint wxTopLevelWindow::GetClientAreaOrigin() const
{
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
int w, h;
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
void wxTopLevelWindow::DoGetClientSize(int *width, int *height) const
{
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
int w, h;
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
void wxTopLevelWindow::DoSetClientSize(int width, int height)
{
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
wxSize size = m_renderer->GetFrameTotalSize(wxSize(width, height),
GetDecorationsStyle());
void wxTopLevelWindow::OnNcPaint(wxNcPaintEvent& event)
{
- if ( !ms_drawDecorations || !m_renderer )
+ if ( m_usingNativeDecorations || !m_renderer )
+ {
event.Skip();
- else
+ }
+ else // we're drawing the decorations ourselves
{
// get the window rect
wxRect rect(GetSize());
int wxTopLevelWindow::GetMinWidth() const
{
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
return wxMax(wxTopLevelWindowNative::GetMinWidth(),
m_renderer->GetFrameMinSize(GetDecorationsStyle()).x);
int wxTopLevelWindow::GetMinHeight() const
{
- if ( ms_drawDecorations )
+ if ( !m_usingNativeDecorations )
{
return wxMax(wxTopLevelWindowNative::GetMinHeight(),
m_renderer->GetFrameMinSize(GetDecorationsStyle()).y);
{
wxTopLevelWindowNative::SetIcons(icons);
- if ( ms_drawDecorations && m_renderer )
+ if ( !m_usingNativeDecorations && m_renderer )
{
wxSize size = m_renderer->GetFrameIconSize();
const wxIcon& icon = icons.GetIcon( size );