#ifdef __GNUG__
-#pragma implementation "window.h"
+ #pragma implementation "window.h"
#endif
#include "wx/defs.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/msgdlg.h"
+
#if wxUSE_DRAG_AND_DROP
-#include "wx/dnd.h"
+ #include "wx/dnd.h"
#endif
+
#if wxUSE_TOOLTIPS
-#include "wx/tooltip.h"
+ #include "wx/tooltip.h"
#endif
+
#include "wx/menu.h"
#include "wx/statusbr.h"
#include "wx/intl.h"
((win->m_windowStyle & wxTE_PROCESS_TAB) == 0))
{
wxNavigationKeyEvent new_event;
+ /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
- new_event.SetWindowChange( FALSE );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
+ if ( (!ret) &&
+ (gdk_event->keyval == GDK_Escape) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( win );
+ ret = win->GetEventHandler()->ProcessEvent( new_event );
+ }
+
/*
+ Damn, I forgot why this didn't work, but it didn't work.
+
// win is a panel: up can be propagated to the panel
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
(gdk_event->keyval == GDK_Up))
if (ret)
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
}
return ret;
wxWindow::~wxWindow()
{
- // Remove potential dangling pointer
- if (GetParent() && GetParent()->IsKindOf(CLASSINFO(wxPanel)))
- {
- wxPanel* panel = (wxPanel*) GetParent();
- if (panel->GetLastFocus() == this)
- panel->SetLastFocus((wxWindow*) NULL);
- }
-
m_hasVMT = FALSE;
#if wxUSE_DRAG_AND_DROP
- wxDELETE(m_dropTarget);
+ if (m_dropTarget)
+ {
+ delete m_dropTarget;
+ m_dropTarget = (wxDropTarget*) NULL;
+ }
#endif
#if wxUSE_TOOLTIPS
- wxDELETE(m_toolTip);
+ if (m_toolTip)
+ {
+ delete m_toolTip;
+ m_toolTip = (wxToolTip*) NULL;
+ }
#endif // wxUSE_TOOLTIPS
- if (m_parent) m_parent->RemoveChild( this );
if (m_widget) Show( FALSE );
DestroyChildren();
+ if (m_parent) m_parent->RemoveChild( this );
+
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
DeleteRelatedConstraints();
if (m_constraints)
{
- // This removes any dangling pointers to this window
- // in other windows' constraintsInvolvedIn lists.
+ /* This removes any dangling pointers to this window
+ * in other windows' constraintsInvolvedIn lists. */
UnsetConstraints(m_constraints);
delete m_constraints;
m_constraints = (wxLayoutConstraints *) NULL;
}
+
if (m_windowSizer)
{
delete m_windowSizer;
m_windowSizer = (wxSizer *) NULL;
}
- // If this is a child of a sizer, remove self from parent
+ /* If this is a child of a sizer, remove self from parent */
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
- // Just in case the window has been Closed, but
- // we're then deleting immediately: don't leave
- // dangling pointers.
+ /* Just in case the window has been Closed, but
+ * we're then deleting immediately: don't leave
+ * dangling pointers. */
wxPendingDelete.DeleteObject(this);
- // Just in case we've loaded a top-level window via
- // wxWindow::LoadNativeDialog but we weren't a dialog
- // class
+ /* Just in case we've loaded a top-level window via
+ * wxWindow::LoadNativeDialog but we weren't a dialog
+ * class */
wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
m_x = (int)pos.x;
m_y = (int)pos.y;
- if (!m_needParent) // some reasonable defaults
+ if (!m_needParent) /* some reasonable defaults */
{
if (m_x == -1)
{
void wxWindow::PostCreation()
{
+ wxASSERT_MSG( (m_widget != NULL), "invalid window" );
+
if (m_wxwindow)
{
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
- GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
+ gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+ GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
- GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+ gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+ GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
}
ConnectWidget( GetConnectWidget() );
- if (m_widget && m_parent) gtk_widget_realize( m_widget );
+ /* we force the creation of wxFrame and wxDialog in the respective code */
+ if (m_parent) gtk_widget_realize( m_widget );
if (m_wxwindow) gtk_widget_realize( m_wxwindow );
event.SetEventObject(this);
event.SetCanVeto(!force);
- // return FALSE if window wasn't closed because the application vetoed the
- // close event
+ /* return FALSE if window wasn't closed because the application vetoed the
+ * close event */
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
}
}
}
-void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
+void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
- if (m_resizing) return; // I don't like recursions
+ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
- if (m_parent->m_wxwindow == NULL) // i.e. wxNotebook
+ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
- // don't set the size for children of wxNotebook, just take the values.
+ /* don't set the size for children of wxNotebook, just take the values. */
m_x = x;
m_y = y;
m_width = width;
UpdateWindowUI();
}
-void wxWindow::SetSize( int width, int height )
-{
- SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING );
-}
-
-void wxWindow::Move( int x, int y )
-{
- SetSize( x, y, -1, -1, wxSIZE_USE_EXISTING );
-}
-
void wxWindow::GetSize( int *width, int *height ) const
{
wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (height) (*height) = m_height;
}
-void wxWindow::SetClientSize( int width, int height )
+void wxWindow::DoSetClientSize( int width, int height )
{
wxCHECK_RET( (m_widget != NULL), "invalid window" );
{
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
+ if (show == m_isShown) return TRUE;
+
if (show)
gtk_widget_show( m_widget );
else