#include "wx/notebook.h"
#include "wx/statusbr.h"
#include <wx/intl.h>
-//#include "wx/treectrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// button_press
-gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
-{
- if (widget->window != gdk_event->window) return TRUE;
+gint gtk_window_button_press_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
+{
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
+
if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow)
//-----------------------------------------------------------------------------
// button_release
-gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
+gint gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
{
- if (widget->window != gdk_event->window) return TRUE;
-
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
//-----------------------------------------------------------------------------
// motion_notify
-gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
+gint gtk_window_motion_notify_callback( GtkWidget *WXUNUSED(widget), GdkEventMotion *gdk_event, wxWindow *win )
{
- if (widget->window != gdk_event->window) return TRUE;
-
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
if (!m_parent)
{
- printf( _("wxWindow::SetSize error.\n") );
+ wxFAIL_MSG( _("wxWindow::SetSize error.\n") );
return;
}
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
}
+int wxWindow::GetCharHeight(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return font->ascent + font->descent;
+}
+
+int wxWindow::GetCharWidth(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return gdk_string_width( font, "H" );
+}
+
+void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
+ int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
+{
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
+
+ GdkFont *font = fontToUse.GetInternalFont( 1.0 );
+ if (x) (*y) = gdk_string_width( font, string );
+ if (y) (*y) = font->ascent + font->descent;
+ if (descent) (*descent) = font->descent;
+ if (externalLeading) (*externalLeading) = 0; // ??
+}
+
void wxWindow::MakeModal( bool modal )
{
return;
return m_retCode;
}
-wxWindow *wxWindow::GetParent(void)
-{
- return m_parent;
-}
-
void wxWindow::Raise(void)
{
if (m_widget) gdk_window_raise( m_widget->window );
return connect_widget;
}
+bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
+{
+ if (m_wxwindow) return (window == m_wxwindow->window);
+ return (window == m_widget->window);
+}
+
void wxWindow::SetFont( const wxFont &font )
{
m_font = font;