#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"
// conditional compilation
//-------------------------------------------------------------------------
-#if (GTK_MINOR_VERSION == 1)
-#if (GTK_MICRO_VERSION >= 5)
+#if (GTK_MINOR_VERSION > 0)
#define NEW_GTK_SCROLL_CODE
#endif
-#endif
//-----------------------------------------------------------------------------
// (debug)
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
-extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
static bool g_capturing = FALSE;
float diff = win->m_vAdjust->value - win->m_oldVerticalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldVerticalPos = win->m_vAdjust->value;
wxEventType command = wxEVT_NULL;
float diff = win->m_hAdjust->value - win->m_oldHorizontalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldHorizontalPos = win->m_hAdjust->value;
wxEventType command = wxEVT_NULL;
EVT_KEY_DOWN(wxWindow::OnKeyDown)
END_EVENT_TABLE()
-wxWindow::wxWindow()
+void wxWindow::Init()
{
+ m_isWindow = TRUE;
+
m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
m_parent = (wxWindow *) NULL;
#endif // wxUSE_TOOLTIPS
}
+wxWindow::wxWindow()
+{
+ Init();
+}
+
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
- m_insertCallback = wxInsertChildInWindow;
+ Init();
+
Create( parent, id, pos, size, style, name );
}
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
- m_isShown = FALSE;
- m_isEnabled = TRUE;
- m_needParent = TRUE;
+ wxASSERT_MSG( m_isWindow, "Init() must have been called before!" );
PreCreation( parent, id, pos, size, style, name );
#ifdef NEW_GTK_SCROLL_CODE
gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), m_wxwindow );
- GtkViewport *viewport = GTK_VIEWPORT(s_window->child);
+ GtkViewport *viewport = GTK_VIEWPORT( GTK_BIN(s_window)->child );
#else
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
}
}
-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" );
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" );
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE
- GtkWidget *viewport = scroll_window->child;
+ GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE
- GtkWidget *viewport = scroll_window->child;
+ GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
- wxNode *node = menu->m_items.First();
+ wxNode *node = menu->GetItems().First();
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
void wxWindow::SetFont( const wxFont &font )
{
wxCHECK_RET( m_widget != NULL, "invalid window" );
-
+
+ if (m_font == font) return;
+
if (((wxFont*)&font)->Ok())
m_font = font;
else