// Created: 24.09.01
// RCS-ID: $Id$
// Copyright: (c) 2002 Julian Smart
-// License: wxWindows licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
#pragma hdrstop
#endif
+#include "wx/toplevel.h"
+
#ifndef WX_PRECOMP
#include "wx/app.h"
- #include "wx/toplevel.h"
#include "wx/string.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/statusbr.h"
+ #include "wx/settings.h"
#endif //WX_PRECOMP
-#include "wx/settings.h"
#include "wx/x11/private.h"
#include "X11/Xutil.h"
{
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
{
- if (GetParent() && GetParent()->GetMainWindow())
+ if (GetParent() && GetParent()->X11GetMainWindow())
{
- Window xparentwindow = (Window) GetParent()->GetMainWindow();
+ Window xparentwindow = (Window) GetParent()->X11GetMainWindow();
XSetTransientForHint( xdisplay, xwindow, xparentwindow );
}
}
if (GetParent())
{
wm_hints.flags |= WindowGroupHint;
- wm_hints.window_group = (Window) GetParent()->GetMainWindow();
+ wm_hints.window_group = (Window) GetParent()->X11GetMainWindow();
}
wm_hints.input = True;
wm_hints.initial_state = NormalState;
{
wxSizeEvent event( GetClientSize(), GetId() );
event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
+ HandleWindowEvent( event );
m_needResizeInIdle = false;
}
wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
m_needResizeInIdle = false;
}
// wxTopLevelWindowX11 maximize/minimize
// ----------------------------------------------------------------------------
-void wxTopLevelWindowX11::Maximize(bool maximize)
+void wxTopLevelWindowX11::Maximize(bool WXUNUSED(maximize))
{
// TODO
}
void wxTopLevelWindowX11::Iconize(bool iconize)
{
- if (!m_iconized && GetMainWindow())
+ if ( !iconize )
+ {
+ Restore();
+ return;
+ }
+
+ if (!m_iconized && X11GetMainWindow())
{
if (XIconifyWindow(wxGlobalDisplay(),
- (Window) GetMainWindow(), DefaultScreen(wxGlobalDisplay())) != 0)
+ (Window) X11GetMainWindow(), DefaultScreen(wxGlobalDisplay())) != 0)
m_iconized = true;
}
}
void wxTopLevelWindowX11::Restore()
{
// This is the way to deiconify the window, according to the X FAQ
- if (m_iconized && GetMainWindow())
+ if (m_iconized && X11GetMainWindow())
{
- XMapWindow(wxGlobalDisplay(), (Window) GetMainWindow());
+ XMapWindow(wxGlobalDisplay(), (Window) X11GetMainWindow());
m_iconized = false;
}
}
void wxTopLevelWindowX11::DoSetIcon(const wxIcon& icon)
{
- if (icon.Ok() && GetMainWindow())
+ if (icon.IsOk() && X11GetMainWindow())
{
-#if wxUSE_NANOX
-#else
+#if !wxUSE_NANOX
XWMHints *wmHints = XAllocWMHints();
wmHints->icon_pixmap = (Pixmap) icon.GetPixmap();
wmHints->icon_mask = (Pixmap) icon.GetMask()->GetBitmap();
}
- XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(), wmHints);
+ XSetWMHints(wxGlobalDisplay(), (Window) X11GetMainWindow(), wmHints);
XFree(wmHints);
#endif
}
wxTopLevelWindowBase::SetIcons( icons );
DoSetIcon( icons.GetIcon( -1 ) );
- wxSetIconsX11( wxGlobalDisplay(), GetMainWindow(), icons );
+ wxSetIconsX11( wxGlobalDisplay(), X11GetMainWindow(), icons );
}
bool wxTopLevelWindowX11::SetShape(const wxRegion& region)
{
return wxDoSetShape( wxGlobalDisplay(),
- (Window)GetMainWindow(),
+ (Window)X11GetMainWindow(),
region );
}
{
m_title = title;
- if (GetMainWindow())
+ if (X11GetMainWindow())
{
#if wxUSE_UNICODE
// I wonder of e.g. Metacity takes UTF-8 here
- XStoreName(wxGlobalDisplay(), (Window) GetMainWindow(),
+ XStoreName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title.ToAscii() );
- XSetIconName(wxGlobalDisplay(), (Window) GetMainWindow(),
+ XSetIconName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title.ToAscii() );
#else
- XStoreName(wxGlobalDisplay(), (Window) GetMainWindow(),
+ XStoreName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title);
- XSetIconName(wxGlobalDisplay(), (Window) GetMainWindow(),
+ XSetIconName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title);
#endif
}
size_hints.flags = PSize;
size_hints.width = width;
size_hints.height = height;
- XSetWMNormalHints( wxGlobalDisplay(), (Window) GetMainWindow(), &size_hints );
+ XSetWMNormalHints( wxGlobalDisplay(), (Window) X11GetMainWindow(), &size_hints );
#endif
wxWindowX11::DoSetClientSize(width, height);
size_hints.y = m_y;
size_hints.width = m_width;
size_hints.height = m_height;
- XSetWMNormalHints( wxGlobalDisplay(), (Window) GetMainWindow(), &size_hints);
+ XSetWMNormalHints( wxGlobalDisplay(), (Window) X11GetMainWindow(), &size_hints);
#endif
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
}
if ((style & wxCAPTION) ||
- (style & wxTINY_CAPTION_HORIZ) ||
- (style & wxTINY_CAPTION_VERT))
+ (style & wxTINY_CAPTION))
{
wmProp.props |= GR_WM_PROPS_CAPTION ;
wmProp.flags |= GR_WM_FLAGS_PROPS ;
// The default dialog style doesn't include any kind
// of border, which is a bit odd. Anyway, inclusion
// of a caption surely implies a border.
- style |= wxTHICK_FRAME;
+ style |= wxRESIZE_BORDER;
}
- if (style & wxTHICK_FRAME)
+ if (style & wxRESIZE_BORDER)
{
wmProp.props |= GR_WM_PROPS_APPFRAME ;
wmProp.flags |= GR_WM_FLAGS_PROPS ;
wmProp.flags |= GR_WM_FLAGS_PROPS ;
}
- if (((style & wxBORDER) != wxBORDER) && ((style & wxTHICK_FRAME) != wxTHICK_FRAME)
+ if (((style & wxBORDER) != wxBORDER) && ((style & wxRESIZE_BORDER) != wxRESIZE_BORDER)
&& ((style & wxRESIZE_BORDER) != wxRESIZE_BORDER))
{
wmProp.props |= GR_WM_PROPS_NODECORATE ;