X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..b919f007af55c6bcba975ead6177c80a317e1a4a:/src/gtk/checkbox.cpp diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 1426171b56..5d638cd07c 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -16,8 +16,8 @@ #if wxUSE_CHECKBOX -#include "gdk/gdk.h" -#include "gtk/gtk.h" +#include +#include //----------------------------------------------------------------------------- // idle system @@ -30,7 +30,8 @@ extern bool g_isIdle; // data //----------------------------------------------------------------------------- -extern bool g_blockEventsOnDrag; +extern bool g_blockEventsOnDrag; +extern wxCursor g_globalCursor; //----------------------------------------------------------------------------- // "clicked" @@ -76,7 +77,7 @@ bool wxCheckBox::Create(wxWindow *parent, !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxCheckBox creation failed") ); - return FALSE; + return FALSE; } wxControl::SetLabel( label ); @@ -105,16 +106,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_widget = m_widgetCheckbox; } - wxSize newSize(size); - if (newSize.x == -1) - { - newSize.x = 25 + gdk_string_measure( m_widgetCheckbox->style->font, - m_label.mbc_str() ); - } - if (newSize.y == -1) - newSize.y = 26; - - SetSize( newSize.x, newSize.y ); + SetSizeOrDefault( size ); gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox), "clicked", @@ -186,4 +178,33 @@ void wxCheckBox::ApplyWidgetStyle() gtk_widget_set_style( m_widgetLabel, m_widgetStyle ); } +bool wxCheckBox::IsOwnGtkWindow( GdkWindow *window ) +{ + return (window == GTK_TOGGLE_BUTTON(m_widget)->event_window); +} + +void wxCheckBox::OnInternalIdle() +{ + wxCursor cursor = m_cursor; + if (g_globalCursor.Ok()) cursor = g_globalCursor; + + if (GTK_TOGGLE_BUTTON(m_widgetCheckbox)->event_window && cursor.Ok()) + { + /* I now set the cursor the anew in every OnInternalIdle call + as setting the cursor in a parent window also effects the + windows above so that checking for the current cursor is + not possible. */ + + gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widgetCheckbox)->event_window, cursor.GetCursor() ); + } + + UpdateWindowUI(); +} + +wxSize wxCheckBox::DoGetBestSize() const +{ + return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font, + m_label.mbc_str() ), 26 ); +} + #endif