// headers
// ---------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "window.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/utils.h"
#include "wx/app.h"
#include "wx/panel.h"
- #include "wx/caret.h"
#endif
#if wxUSE_DRAG_AND_DROP
#include "wx/mgl/private.h"
#include "wx/intl.h"
#include "wx/dcscreen.h"
+#include "wx/caret.h"
#include <mgraph.hpp>
// constructors and such
// ----------------------------------------------------------------------------
-extern wxDisplayModeInfo wxGetDefaultDisplayMode();
+extern wxVideoMode wxGetDefaultDisplayMode();
void wxWindowMGL::Init()
{
wxLogFatalError(_("Cannot initialize display."));
}
- // generic:
- InitBase();
-
// mgl specific:
m_wnd = NULL;
m_isShown = TRUE;
- m_isBeingDeleted = FALSE;
- m_isEnabled = TRUE;
m_frozen = FALSE;
m_paintMGLDC = NULL;
m_eraseBackground = -1;
if ( gs_windowUnderMouse == this )
gs_windowUnderMouse = NULL;
- // VS: destroy children first and _then_ detach *this from its parent.
- // If we'd do it the other way around, children wouldn't be able
- // find their parent frame (see above).
DestroyChildren();
- if ( m_parent )
- m_parent->RemoveChild(this);
-
if ( m_wnd )
MGL_wmDestroyWindow(m_wnd);
}
long mgl_style = 0;
window_t *wnd_parent = parent ? parent->GetHandle() : NULL;
- if ( !(style & wxNO_FULL_REPAINT_ON_RESIZE) )
+ if ( style & wxFULL_REPAINT_ON_RESIZE )
{
mgl_style |= MGL_WM_FULL_REPAINT_ON_RESIZE;
}
// this wxWindowBase function is implemented here (in platform-specific file)
// because it is static and so couldn't be made virtual
// ----------------------------------------------------------------------------
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
{
return (wxWindow*)gs_focusedWindow;
}
void wxWindowMGL::DoMoveWindow(int x, int y, int width, int height)
{
- MGL_wmSetWindowPosition(GetHandle(), x, y, width, height);
+ wxRect rcClient(GetClientRect());
+
+ MGL_wmSetWindowPosition(m_wnd, x, y, width, height);
+
+ // When the origin or a window stays fixed but the height or width
+ // changes, invalidate the old and new non-client areas
+ if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) &&
+ m_wnd->x == x && m_wnd->y == y &&
+ rcClient.Intersect(GetClientRect()) != wxRect(0, 0, width, height) )
+ {
+ wxRegion rgn(0, 0, width, height);
+ rgn.Subtract(rcClient);
+
+ // This should work I think, but doesn't seem to:
+ //MGL_wmInvalidateWindowRegion(m_wnd, rgn.GetMGLRegion().rgnPointer());
+
+ // Use MGL_wmInvalidateWindowRect instead:
+ for (wxRegionIterator it(rgn); it; it++)
+ {
+ rect_t rc;
+ rc.left = it.GetX();
+ rc.top = it.GetY();
+ rc.right = rc.left + it.GetW();
+ rc.bottom = rc.top + it.GetH();
+ MGL_wmInvalidateWindowRect(m_wnd, &rc);
+ }
+ }
}
// set the size of the window: if the dimensions are positive, just use them,