WXDEBUG_DEFINE="-D__WXDEBUG__"
+else
+ WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
+
fi
if test "$wxUSE_MEM_TRACING" = 1 ; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:6579: checking for main in -ldl" >&5
+echo "configure:6582: checking for main in -ldl" >&5
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6587 "configure"
+#line 6590 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking "for threads"""... $ac_c" 1>&6
-echo "configure:6624: checking "for threads"" >&5
+echo "configure:6627: checking "for threads"" >&5
# Check whether --with-threads or --without-threads was given.
if test "${with_threads+set}" = set; then
withval="$with_threads"
echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
-echo "configure:6658: checking for pthread_create in -lpthread-0.7" >&5
+echo "configure:6661: checking for pthread_create in -lpthread-0.7" >&5
ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread-0.7 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6666 "configure"
+#line 6669 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:6677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
-echo "configure:6701: checking for sys/prctl.h" >&5
+echo "configure:6704: checking for sys/prctl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6706 "configure"
+#line 6709 "configure"
#include "confdefs.h"
#include <sys/prctl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
-echo "configure:6737: checking for pthread_setcanceltype in -lpthread" >&5
+echo "configure:6740: checking for pthread_setcanceltype in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6745 "configure"
+#line 6748 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_setcanceltype()
; return 0; }
EOF
-if { (eval echo configure:6756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for pthread_setcanceltype in -lpthreads""... $ac_c" 1>&6
-echo "configure:6783: checking for pthread_setcanceltype in -lpthreads" >&5
+echo "configure:6786: checking for pthread_setcanceltype in -lpthreads" >&5
ac_lib_var=`echo pthreads'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthreads $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6791 "configure"
+#line 6794 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_setcanceltype()
; return 0; }
EOF
-if { (eval echo configure:6802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$wxUSE_OPENGL" = 1; then
echo $ac_n "checking for OpenGL includes""... $ac_c" 1>&6
-echo "configure:6846: checking for OpenGL includes" >&5
+echo "configure:6849: checking for OpenGL includes" >&5
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
OPENGL_INCLUDE="-I$ac_find_includes"
echo "$ac_t""found $ac_find_includes" 1>&6
echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6
-echo "configure:6861: checking for OpenGL library" >&5
+echo "configure:6864: checking for OpenGL library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
AC_DEFINE_UNQUOTED(WXDEBUG,$wxUSE_DEBUG_FLAG)
WXDEBUG_DEFINE="-D__WXDEBUG__"
AC_SUBST(WXDEBUG_DEFINE)
+else
+ WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
+ AC_SUBST(WXDEBUG_DEFINE)
fi
if test "$wxUSE_MEM_TRACING" = 1 ; then
void SetLabel( const wxString &label );
void Enable( bool enable );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKBUTTONH__
void SetLabel( const wxString& label );
void SetFont( const wxFont &font );
void Enable( bool enable );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKCHECKBOXH__
void SetStringSelection( const wxString &string );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
+
};
#endif // __GTKCHOICEH__
void SetNumberOfRowsOrCols( int n );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
void OnSize( wxSizeEvent &event );
// implementation
// Name: radiobut.h
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
virtual bool GetValue(void) const;
void SetFont( const wxFont &font );
void Enable( bool enable );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKRADIOBUTTONH__
void ConnectDnDWidget( GtkWidget *widget );
void DisconnectDnDWidget( GtkWidget *widget );
- void SetBackgroundColourHelper( GdkWindow *window );
-
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
void SetLabel( const wxString &label );
void Enable( bool enable );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKBUTTONH__
void SetLabel( const wxString& label );
void SetFont( const wxFont &font );
void Enable( bool enable );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKCHECKBOXH__
void SetStringSelection( const wxString &string );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
+
};
#endif // __GTKCHOICEH__
void SetNumberOfRowsOrCols( int n );
void SetFont( const wxFont &font );
+ void SetBackgroundColour( const wxColour &colour );
void OnSize( wxSizeEvent &event );
// implementation
// Name: radiobut.h
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
virtual bool GetValue(void) const;
void SetFont( const wxFont &font );
void Enable( bool enable );
+ void SetBackgroundColour( const wxColour &colour );
};
#endif // __GTKRADIOBUTTONH__
void ConnectDnDWidget( GtkWidget *widget );
void DisconnectDnDWidget( GtkWidget *widget );
- void SetBackgroundColourHelper( GdkWindow *window );
-
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
{
m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE );
- m_text->SetBackgroundColour("yellow");
+ m_text->SetBackgroundColour("wheat");
m_notebook = new wxNotebook( this, ID_NOTEBOOK, wxPoint(0,0), wxSize(200,150) );
m_notebook->SetImageList(imagelist);
wxPanel *panel = new wxPanel(m_notebook);
+ panel->SetBackgroundColour("cadet blue");
m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 4, choices );
- m_listbox->SetBackgroundColour("red");
+ m_listbox->SetBackgroundColour("wheat");
(void)new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
- wxButton *btn = new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
- btn->SetBackgroundColour("green");
+ (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
(void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
(void)new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
panel = new wxPanel(m_notebook);
+ panel->SetBackgroundColour("cadet blue");
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 4, choices );
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
panel = new wxPanel(m_notebook);
+ panel->SetBackgroundColour("cadet blue");
m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 4, choices );
+ m_combo->SetBackgroundColour("wheat");
(void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
(void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
(void)new wxCheckBox( panel, ID_COMBO_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo);
- wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
- m_notebook->AddPage(text, "wxTextCtrl" , FALSE, Image_Text);
+ panel = new wxPanel(m_notebook);
+ panel->SetBackgroundColour("cadet blue");
+ wxTextCtrl *tc = new wxTextCtrl( panel, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(350,28));
+ tc->SetBackgroundColour("wheat");
+ tc = new wxTextCtrl( panel, ID_TEXT, "And here.", wxPoint(10,50), wxSize(350,160), wxTE_MULTILINE );
+ tc->SetBackgroundColour("wheat");
+ m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text);
panel = new wxPanel(m_notebook);
+ panel->SetBackgroundColour("cadet blue");
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 4, choices );
(void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) );
bool ret = wxWindow::Create(parent, id, pos, size, style, name);
if ( ret ) {
+#ifndef __WXGTK__
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+#endif
}
return ret;
// Name: bmpbuttn.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxBitmapButton::SetLabel( const wxString &label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::SetLabel( label );
}
wxString wxBitmapButton::GetLabel(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid button" );
+
return wxControl::GetLabel();
}
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
m_bitmap = bitmap;
if (!m_bitmap.Ok()) return;
gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask );
}
-
-
-
// Name: brush.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
PostCreation();
+
+ SetBackgroundColour( parent->GetBackgroundColour() );
Show( TRUE );
void wxButton::SetLabel( const wxString &label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::SetLabel( label );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkLabel *g_label = GTK_LABEL( bin->child );
- gtk_label_set( g_label, GetLabel() );
+
+ gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
}
void wxButton::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxButton::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxButton::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
+
+
PostCreation();
+ gtk_widget_realize( GTK_BUTTON( m_widget )->child );
+
SetLabel( label );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxCheckBox::SetValue( bool state )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
if (state)
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else
bool wxCheckBox::GetValue() const
{
- GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
- return tb->active;
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid checkbox" );
+
+ return GTK_TOGGLE_BUTTON(m_widget)->active;
}
void wxCheckBox::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
wxControl::SetLabel( label );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkLabel *g_label = GTK_LABEL( bin->child );
- gtk_label_set( g_label, GetLabel() );
+
+ gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
}
void wxCheckBox::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxCheckBox::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxCheckBox::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
+
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
- GtkWidget *menu;
- menu = gtk_menu_new();
+ GtkWidget *menu = gtk_menu_new();
for (int i = 0; i < n; i++)
{
- GtkWidget *item;
- item = gtk_menu_item_new_with_label( choices[i] );
+ GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
+
gtk_menu_append( GTK_MENU(menu), item );
+
gtk_widget_show( item );
+ gtk_widget_realize( item );
+ gtk_widget_realize( GTK_BIN(item)->child );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxChoice::Append( const wxString &item )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
- GtkWidget *menu_item;
- menu_item = gtk_menu_item_new_with_label( item );
+ GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
+
+ gtk_menu_append( GTK_MENU(menu), menu_item );
+
+ gtk_widget_realize( menu_item );
+ gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_hasOwnStyle)
{
+
GtkBin *bin = GTK_BIN( menu_item );
+
gtk_widget_set_style( bin->child,
gtk_style_ref(
gtk_widget_get_style( m_widget ) ) );
+
+ gtk_widget_set_style( GTK_WIDGET( bin ),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
- gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item );
}
void wxChoice::Clear(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
int wxChoice::FindString( const wxString &string ) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
+
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
int wxChoice::GetSelection(void)
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
wxString wxChoice::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
wxString wxChoice::GetStringSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
+
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
int wxChoice::Number(void) const
{
+ wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
void wxChoice::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
void wxChoice::SetStringSelection( const wxString &string )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
int n = FindString( string );
if (n != -1) SetSelection( n );
}
void wxChoice::SetFont( const wxFont &font )
{
- wxWindow::SetFont( font );
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
+ wxControl::SetFont( font );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
GList *child = menu_shell->children;
child = child->next;
}
}
+
+void wxChoice::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ if (!m_backgroundColour.Ok()) return;
+
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+
+ GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
+
+ gtk_widget_set_style( GTK_WIDGET( menu_shell ), gtk_style_ref( style ) );
+
+ GList *child = menu_shell->children;
+ while (child)
+ {
+ gtk_widget_set_style( GTK_WIDGET( child->data ), gtk_style_ref( style ) );
+ child = child->next;
+ }
+}
+
+
+
for (int i = 0; i < n; i++)
{
- GtkWidget *list_item;
- list_item = gtk_list_item_new_with_label( choices[i] );
+ GtkWidget *list_item = gtk_list_item_new_with_label( choices[i] );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_container_add( GTK_CONTAINER(list), list_item );
- m_clientData.Append( (wxObject*)NULL );
+ gtk_widget_realize( list_item );
+ gtk_widget_realize( GTK_BIN(list_item)->child );
gtk_widget_show( list_item );
if (!value.IsNull()) SetValue( value );
+ gtk_widget_realize( GTK_COMBO(m_widget)->list );
+ gtk_widget_realize( GTK_COMBO(m_widget)->entry );
+ gtk_widget_realize( GTK_COMBO(m_widget)->button );
+
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxComboBox::Clear(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
void wxComboBox::Append( const wxString &item )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
Append( item, (char*)NULL );
}
void wxComboBox::Append( const wxString &item, char *clientData )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GtkWidget *list_item = gtk_list_item_new_with_label( item );
gtk_widget_set_style( bin->child,
gtk_style_ref(
gtk_widget_get_style( m_widget ) ) );
- }
-
- if (m_backgroundColour != wxNullColour)
- {
- GtkBin *bin = GTK_BIN( list_item );
- SetBackgroundColourHelper( bin->child->window );
+ gtk_widget_set_style( GTK_WIDGET(bin),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
void wxComboBox::Delete( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
GList *child = g_list_nth( listbox->children, n );
int wxComboBox::FindString( const wxString &item )
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
char* wxComboBox::GetClientData( int n )
{
+ wxCHECK_MSG( m_widget != NULL, (char*)NULL, "invalid combobox" );
+
wxNode *node = m_clientData.Nth( n );
if (node) return (char*)node->Data();
void wxComboBox::SetClientData( int n, char * clientData )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
wxNode *node = m_clientData.Nth( n );
if (node) node->SetData( (wxObject*) clientData );
int wxComboBox::GetSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *selection = GTK_LIST(list)->selection;
wxString wxComboBox::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = g_list_nth( GTK_LIST(list)->children, n );
wxString wxComboBox::GetStringSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *selection = GTK_LIST(list)->selection;
int wxComboBox::Number(void) const
{
+ wxCHECK_MSG( m_widget != NULL, 0, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
void wxComboBox::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n );
}
void wxComboBox::SetStringSelection( const wxString &string )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
int res = FindString( string );
if (res == -1) return;
SetSelection( res );
void wxComboBox::SetValue( const wxString& value )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = "";
if (!value.IsNull()) tmp = value;
void wxComboBox::Copy(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::Cut(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::Paste(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::SetInsertionPoint( long pos )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp );
void wxComboBox::SetInsertionPointEnd(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 );
void wxComboBox::Replace( long from, long to, const wxString& value )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
if (value.IsNull()) return;
void wxComboBox::Remove(long from, long to)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
}
{
wxControl::OnSize( event );
- int w = 22;
+ int w = 21;
gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
void wxComboBox::SetFont( const wxFont &font )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
wxWindow::SetFont( font );
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
void wxComboBox::SetBackgroundColour( const wxColour &colour )
{
- wxWindow::SetBackgroundColour( colour );
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
- GtkWidget *list = GTK_COMBO(m_widget)->list;
+ m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- GList *child = GTK_LIST(list)->children;
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+ }
+
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_widget, style );
+
+ gtk_widget_set_style( GTK_COMBO(m_widget)->button, gtk_style_ref( style ) );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->entry, gtk_style_ref( style ) );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->list, gtk_style_ref( style ) );
+
+ GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children;
while (child)
{
- GtkBin *bin = (GtkBin*) child->data;
- SetBackgroundColourHelper( bin->child->window );
+ GtkWidget *item = GTK_WIDGET(child->data);
+ gtk_widget_set_style( item, gtk_style_ref( style ) );
child = child->next;
}
}
{
if (!Ok()) return FALSE;
- if (m_isMemDC)
+ wxClientDC *csrc = (wxClientDC*)source;
+
+ if (csrc->m_isMemDC)
{
wxMemoryDC* srcDC = (wxMemoryDC*)source;
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
}
}
- wxClientDC *csrc = (wxClientDC*)source;
gdk_window_copy_area ( m_window, m_penGC,
XLOG2DEV(xdest), YLOG2DEV(ydest),
csrc->GetWindow(),
// Name: listbox.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
gtk_widget_realize( GTK_WIDGET(m_list) );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxListBox::Append( const wxString &item, char *clientData )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GtkWidget *list_item = gtk_list_item_new_with_label( item );
GtkBin *bin = GTK_BIN( list_item );
gtk_widget_set_style( bin->child,
gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
-
- gtk_widget_set_style( GTK_WIDGET(bin),
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
void wxListBox::Clear(void)
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
gtk_list_clear_items( m_list, 0, Number() );
void wxListBox::Delete( int n )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
void wxListBox::Deselect( int n )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
gtk_list_unselect_item( m_list, n );
}
int wxListBox::FindString( const wxString &item ) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
char *wxListBox::GetClientData( int n ) const
{
- wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid listbox" );
wxNode *node = m_clientData.Nth( n );
if (node) return ((char*)node->Data());
int wxListBox::GetSelection(void) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
// get the number of selected items first
GList *child = m_list->children;
wxString wxListBox::GetString( int n ) const
{
- wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
if (child)
wxString wxListBox::GetStringSelection(void) const
{
- wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
GList *selection = m_list->selection;
if (selection)
int wxListBox::Number(void)
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
bool wxListBox::Selected( int n )
{
- wxCHECK_MSG( m_list != NULL, FALSE, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
GList *target = g_list_nth( m_list->children, n );
if (target)
void wxListBox::SetClientData( int n, char *clientData )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
wxNode *node = m_clientData.Nth( n );
if (node)
void wxListBox::SetSelection( int n, bool select )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
if (select)
gtk_list_select_item( m_list, n );
void wxListBox::SetString( int n, const wxString &string )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
if (child)
void wxListBox::SetStringSelection( const wxString &string, bool select )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
SetSelection( FindString(string), select );
}
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = m_list->children;
while (child)
return GTK_WIDGET(m_list);
}
-void wxListBox::SetFont( const wxFont &font )
+bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
-
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
- }
- else
- {
- style = gtk_widget_get_style( GTK_WIDGET(m_list) );
- }
-
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
-
- gtk_widget_set_style( GTK_WIDGET(m_list), style );
-
+ if (wxWindow::IsOwnGtkWindow( window )) return TRUE;
GList *child = m_list->children;
while (child)
{
- GtkBin *bin = (GtkBin*) child->data;
- gtk_widget_set_style( bin->child,
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ GtkBin *bin = GTK_BIN( child->data );
+ if (bin->child->window == window) return TRUE;
child = child->next;
}
+
+ return FALSE;
}
-bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
+void wxListBox::SetFont( const wxFont &font )
{
- if (wxWindow::IsOwnGtkWindow( window )) return TRUE;
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
+
+ wxControl::SetFont( font );
GList *child = m_list->children;
while (child)
{
- GtkBin *bin = GTK_BIN( child->data );
- if (bin->child->window == window) return TRUE;
+ gtk_widget_set_style( GTK_BIN(child->data)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
child = child->next;
}
-
- return FALSE;
}
void wxListBox::SetBackgroundColour( const wxColour &colour )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ return;
- m_backgroundColour = colour;
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ return;
+
if (!m_backgroundColour.Ok()) return;
- SetBackgroundColourHelper( GTK_WIDGET(m_list)->window );
-
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
- }
- else
- {
- style = gtk_widget_get_style( GTK_WIDGET(m_list) );
- }
-
- style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
- style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-
- gtk_widget_set_style( GTK_WIDGET(m_list), style );
-
+ gtk_widget_set_style( GTK_WIDGET(m_list),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
GList *child = m_list->children;
while (child)
{
- GtkWidget *item = GTK_WIDGET(child->data);
- gtk_widget_set_style( item,
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ gtk_widget_set_style( GTK_WIDGET(child->data),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
+ gtk_widget_set_style( GTK_BIN(child->data)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
child = child->next;
}
}
// Name: radiobox.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
SetLabel( title );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
bool wxRadioBox::Show( bool show )
{
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
+
wxWindow::Show( show );
wxNode *node = m_boxes.First();
int wxRadioBox::FindString( const wxString &s ) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
+
int count = 0;
wxNode *node = m_boxes.First();
void wxRadioBox::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( n );
if (!node)
int wxRadioBox::GetSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
+
int count = 0;
wxNode *node = m_boxes.First();
wxString wxRadioBox::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( n );
if (!node)
wxString wxRadioBox::GetLabel( int item ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
+
return GetString( item );
}
void wxRadioBox::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxControl::SetLabel( label );
- GtkFrame *frame = GTK_FRAME( m_widget );
- gtk_frame_set_label( frame, wxControl::GetLabel() );
+
+ gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( item );
if (!node)
void wxRadioBox::SetFont( const wxFont &font )
{
- wxWindow::SetFont( font );
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
+ wxControl::SetFont( font );
wxNode *node = m_boxes.First();
while (node)
}
}
+void wxRadioBox::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ if (!m_backgroundColour.Ok()) return;
+
+ wxNode *node = m_boxes.First();
+ while (node)
+ {
+ GtkWidget *button = GTK_WIDGET( node->Data() );
+
+ gtk_widget_set_style( button,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
+ node = node->Next();
+ }
+}
+
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
if (window == m_widget->window) return TRUE;
// Name: radiobut.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
void wxRadioButton::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
wxControl::SetLabel( label );
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
void wxRadioButton::SetValue( bool val )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
}
bool wxRadioButton::GetValue(void) const
{
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobutton" );
+
return GTK_TOGGLE_BUTTON(m_widget)->active;
}
void wxRadioButton::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxRadioButton::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxRadioButton::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
// Name: region.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/98
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
// Name: settings.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Name: slider.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
// Name: textctrl.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
Show( TRUE );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
return TRUE;
}
void wxTextCtrl::SetValue( const wxString &value )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
wxString tmp = "";
if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE)
void wxTextCtrl::WriteText( const wxString &text )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE)
void wxTextCtrl::SetInsertionPointEnd()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) );
void wxTextCtrl::SetEditable( bool editable )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable );
else
void wxTextCtrl::SetSelection( long from, long to )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
{
- wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented"));
+ wxFAIL_MSG( "wxTextCtrl::ShowPosition not implemented" );
}
long wxTextCtrl::GetInsertionPoint() const
{
+ wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
+
return (long) GTK_EDITABLE(m_text)->current_pos;
}
long wxTextCtrl::GetLastPosition() const
{
+ wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
+
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) );
void wxTextCtrl::Remove( long from, long to )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}
void wxTextCtrl::Replace( long from, long to, const wxString &value )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return;
gint pos = (gint)to;
void wxTextCtrl::Cut()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::Copy()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::Paste()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::SetFont( const wxFont &font )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (((wxFont*)&font)->Ok())
m_font = font;
else
m_font = *wxSWISS_FONT;
- GtkStyle *style = (GtkStyle*) NULL;
+ GtkStyle *style = gtk_widget_get_style( m_text );
if (!m_hasOwnStyle)
{
m_hasOwnStyle = TRUE;
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
}
- else
- {
- style = gtk_widget_get_style( m_text );
- }
gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
+ return;
+
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- SetBackgroundColourHelper( GTK_TEXT(m_text)->text_area );
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ GdkWindow *window = GTK_TEXT(m_text)->text_area;
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+ gdk_window_set_background( window, m_backgroundColour.GetColor() );
+ gdk_window_clear( window );
+ }
+ else
+ {
+ GtkStyle *style = gtk_widget_get_style( m_text );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( gtk_widget_get_style( m_text ) );
+ }
+
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_text->window ) );
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_text, style );
+ }
}
+
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_hasOwnStyle = FALSE;
+ m_scrollGC = (GdkGC*) NULL;
}
void wxWindow::PostCreation()
return m_backgroundColour;
}
-void wxWindow::SetBackgroundColourHelper( GdkWindow *window )
-{
- if (!m_backgroundColour.Ok()) return;
-
- m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
- gdk_window_set_background( window, m_backgroundColour.GetColor() );
- gdk_window_clear( window );
-}
-
void wxWindow::SetBackgroundColour( const wxColour &colour )
{
wxCHECK_RET( m_widget != NULL, "invalid window" );
m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
- SetBackgroundColourHelper( widget->window );
+ if (m_wxwindow)
+ {
+ GdkWindow *window = m_wxwindow->window;
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+ gdk_window_set_background( window, m_backgroundColour.GetColor() );
+ gdk_window_clear( window );
+ }
+ else
+ {
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( style );
+ }
+
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_widget, style );
+ }
}
wxColour wxWindow::GetForegroundColour() const
else
m_font = *wxSWISS_FONT;
- GtkStyle *style = (GtkStyle*) NULL;
+ GtkStyle *style = gtk_widget_get_style( m_widget );
if (!m_hasOwnStyle)
{
m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
- }
- else
- {
- style = gtk_widget_get_style( m_widget );
+ style = gtk_style_copy( style );
}
gdk_font_unref( style->font );
// Name: bmpbuttn.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxBitmapButton::SetLabel( const wxString &label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::SetLabel( label );
}
wxString wxBitmapButton::GetLabel(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid button" );
+
return wxControl::GetLabel();
}
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
m_bitmap = bitmap;
if (!m_bitmap.Ok()) return;
gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask );
}
-
-
-
// Name: brush.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
PostCreation();
+
+ SetBackgroundColour( parent->GetBackgroundColour() );
Show( TRUE );
void wxButton::SetLabel( const wxString &label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::SetLabel( label );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkLabel *g_label = GTK_LABEL( bin->child );
- gtk_label_set( g_label, GetLabel() );
+
+ gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
}
void wxButton::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxButton::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxButton::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid button" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
+
+
PostCreation();
+ gtk_widget_realize( GTK_BUTTON( m_widget )->child );
+
SetLabel( label );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxCheckBox::SetValue( bool state )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
if (state)
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else
bool wxCheckBox::GetValue() const
{
- GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
- return tb->active;
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid checkbox" );
+
+ return GTK_TOGGLE_BUTTON(m_widget)->active;
}
void wxCheckBox::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
wxControl::SetLabel( label );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkLabel *g_label = GTK_LABEL( bin->child );
- gtk_label_set( g_label, GetLabel() );
+
+ gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
}
void wxCheckBox::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxCheckBox::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxCheckBox::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
+
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
- GtkWidget *menu;
- menu = gtk_menu_new();
+ GtkWidget *menu = gtk_menu_new();
for (int i = 0; i < n; i++)
{
- GtkWidget *item;
- item = gtk_menu_item_new_with_label( choices[i] );
+ GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
+
gtk_menu_append( GTK_MENU(menu), item );
+
gtk_widget_show( item );
+ gtk_widget_realize( item );
+ gtk_widget_realize( GTK_BIN(item)->child );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxChoice::Append( const wxString &item )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
- GtkWidget *menu_item;
- menu_item = gtk_menu_item_new_with_label( item );
+ GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
+
+ gtk_menu_append( GTK_MENU(menu), menu_item );
+
+ gtk_widget_realize( menu_item );
+ gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_hasOwnStyle)
{
+
GtkBin *bin = GTK_BIN( menu_item );
+
gtk_widget_set_style( bin->child,
gtk_style_ref(
gtk_widget_get_style( m_widget ) ) );
+
+ gtk_widget_set_style( GTK_WIDGET( bin ),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
- gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item );
}
void wxChoice::Clear(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
int wxChoice::FindString( const wxString &string ) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
+
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
int wxChoice::GetSelection(void)
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
wxString wxChoice::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
wxString wxChoice::GetStringSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
+
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
int wxChoice::Number(void) const
{
+ wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
void wxChoice::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
void wxChoice::SetStringSelection( const wxString &string )
{
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
int n = FindString( string );
if (n != -1) SetSelection( n );
}
void wxChoice::SetFont( const wxFont &font )
{
- wxWindow::SetFont( font );
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
+ wxControl::SetFont( font );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
GList *child = menu_shell->children;
child = child->next;
}
}
+
+void wxChoice::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid choice" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ if (!m_backgroundColour.Ok()) return;
+
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+
+ GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
+
+ gtk_widget_set_style( GTK_WIDGET( menu_shell ), gtk_style_ref( style ) );
+
+ GList *child = menu_shell->children;
+ while (child)
+ {
+ gtk_widget_set_style( GTK_WIDGET( child->data ), gtk_style_ref( style ) );
+ child = child->next;
+ }
+}
+
+
+
for (int i = 0; i < n; i++)
{
- GtkWidget *list_item;
- list_item = gtk_list_item_new_with_label( choices[i] );
+ GtkWidget *list_item = gtk_list_item_new_with_label( choices[i] );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_container_add( GTK_CONTAINER(list), list_item );
- m_clientData.Append( (wxObject*)NULL );
+ gtk_widget_realize( list_item );
+ gtk_widget_realize( GTK_BIN(list_item)->child );
gtk_widget_show( list_item );
if (!value.IsNull()) SetValue( value );
+ gtk_widget_realize( GTK_COMBO(m_widget)->list );
+ gtk_widget_realize( GTK_COMBO(m_widget)->entry );
+ gtk_widget_realize( GTK_COMBO(m_widget)->button );
+
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxComboBox::Clear(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
void wxComboBox::Append( const wxString &item )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
Append( item, (char*)NULL );
}
void wxComboBox::Append( const wxString &item, char *clientData )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GtkWidget *list_item = gtk_list_item_new_with_label( item );
gtk_widget_set_style( bin->child,
gtk_style_ref(
gtk_widget_get_style( m_widget ) ) );
- }
-
- if (m_backgroundColour != wxNullColour)
- {
- GtkBin *bin = GTK_BIN( list_item );
- SetBackgroundColourHelper( bin->child->window );
+ gtk_widget_set_style( GTK_WIDGET(bin),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
void wxComboBox::Delete( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
GList *child = g_list_nth( listbox->children, n );
int wxComboBox::FindString( const wxString &item )
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
char* wxComboBox::GetClientData( int n )
{
+ wxCHECK_MSG( m_widget != NULL, (char*)NULL, "invalid combobox" );
+
wxNode *node = m_clientData.Nth( n );
if (node) return (char*)node->Data();
void wxComboBox::SetClientData( int n, char * clientData )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
wxNode *node = m_clientData.Nth( n );
if (node) node->SetData( (wxObject*) clientData );
int wxComboBox::GetSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *selection = GTK_LIST(list)->selection;
wxString wxComboBox::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = g_list_nth( GTK_LIST(list)->children, n );
wxString wxComboBox::GetStringSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *selection = GTK_LIST(list)->selection;
int wxComboBox::Number(void) const
{
+ wxCHECK_MSG( m_widget != NULL, 0, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
void wxComboBox::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n );
}
void wxComboBox::SetStringSelection( const wxString &string )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
int res = FindString( string );
if (res == -1) return;
SetSelection( res );
void wxComboBox::SetValue( const wxString& value )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = "";
if (!value.IsNull()) tmp = value;
void wxComboBox::Copy(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::Cut(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::Paste(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
void wxComboBox::SetInsertionPoint( long pos )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp );
void wxComboBox::SetInsertionPointEnd(void)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 );
void wxComboBox::Replace( long from, long to, const wxString& value )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
if (value.IsNull()) return;
void wxComboBox::Remove(long from, long to)
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
}
{
wxControl::OnSize( event );
- int w = 22;
+ int w = 21;
gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
void wxComboBox::SetFont( const wxFont &font )
{
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+
wxWindow::SetFont( font );
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
void wxComboBox::SetBackgroundColour( const wxColour &colour )
{
- wxWindow::SetBackgroundColour( colour );
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid combobox" );
- GtkWidget *list = GTK_COMBO(m_widget)->list;
+ m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- GList *child = GTK_LIST(list)->children;
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+ }
+
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_widget, style );
+
+ gtk_widget_set_style( GTK_COMBO(m_widget)->button, gtk_style_ref( style ) );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->entry, gtk_style_ref( style ) );
+ gtk_widget_set_style( GTK_COMBO(m_widget)->list, gtk_style_ref( style ) );
+
+ GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children;
while (child)
{
- GtkBin *bin = (GtkBin*) child->data;
- SetBackgroundColourHelper( bin->child->window );
+ GtkWidget *item = GTK_WIDGET(child->data);
+ gtk_widget_set_style( item, gtk_style_ref( style ) );
child = child->next;
}
}
{
if (!Ok()) return FALSE;
- if (m_isMemDC)
+ wxClientDC *csrc = (wxClientDC*)source;
+
+ if (csrc->m_isMemDC)
{
wxMemoryDC* srcDC = (wxMemoryDC*)source;
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
}
}
- wxClientDC *csrc = (wxClientDC*)source;
gdk_window_copy_area ( m_window, m_penGC,
XLOG2DEV(xdest), YLOG2DEV(ydest),
csrc->GetWindow(),
// Name: listbox.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
gtk_widget_realize( GTK_WIDGET(m_list) );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
void wxListBox::Append( const wxString &item, char *clientData )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GtkWidget *list_item = gtk_list_item_new_with_label( item );
GtkBin *bin = GTK_BIN( list_item );
gtk_widget_set_style( bin->child,
gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
-
- gtk_widget_set_style( GTK_WIDGET(bin),
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ gtk_widget_get_style( m_widget ) ) );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
void wxListBox::Clear(void)
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
gtk_list_clear_items( m_list, 0, Number() );
void wxListBox::Delete( int n )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
void wxListBox::Deselect( int n )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
gtk_list_unselect_item( m_list, n );
}
int wxListBox::FindString( const wxString &item ) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
char *wxListBox::GetClientData( int n ) const
{
- wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, (char*) NULL, "invalid listbox" );
wxNode *node = m_clientData.Nth( n );
if (node) return ((char*)node->Data());
int wxListBox::GetSelection(void) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
// get the number of selected items first
GList *child = m_list->children;
wxString wxListBox::GetString( int n ) const
{
- wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
if (child)
wxString wxListBox::GetStringSelection(void) const
{
- wxCHECK_MSG( m_list != NULL, "", "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
GList *selection = m_list->selection;
if (selection)
int wxListBox::Number(void)
{
- wxCHECK_MSG( m_list != NULL, -1, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
GList *child = m_list->children;
int count = 0;
bool wxListBox::Selected( int n )
{
- wxCHECK_MSG( m_list != NULL, FALSE, "invalid list ctrl" );
+ wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
GList *target = g_list_nth( m_list->children, n );
if (target)
void wxListBox::SetClientData( int n, char *clientData )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
wxNode *node = m_clientData.Nth( n );
if (node)
void wxListBox::SetSelection( int n, bool select )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
if (select)
gtk_list_select_item( m_list, n );
void wxListBox::SetString( int n, const wxString &string )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = g_list_nth( m_list->children, n );
if (child)
void wxListBox::SetStringSelection( const wxString &string, bool select )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
SetSelection( FindString(string), select );
}
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
GList *child = m_list->children;
while (child)
return GTK_WIDGET(m_list);
}
-void wxListBox::SetFont( const wxFont &font )
+bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
-
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
-
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
- }
- else
- {
- style = gtk_widget_get_style( GTK_WIDGET(m_list) );
- }
-
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
-
- gtk_widget_set_style( GTK_WIDGET(m_list), style );
-
+ if (wxWindow::IsOwnGtkWindow( window )) return TRUE;
GList *child = m_list->children;
while (child)
{
- GtkBin *bin = (GtkBin*) child->data;
- gtk_widget_set_style( bin->child,
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ GtkBin *bin = GTK_BIN( child->data );
+ if (bin->child->window == window) return TRUE;
child = child->next;
}
+
+ return FALSE;
}
-bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
+void wxListBox::SetFont( const wxFont &font )
{
- if (wxWindow::IsOwnGtkWindow( window )) return TRUE;
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
+
+ wxControl::SetFont( font );
GList *child = m_list->children;
while (child)
{
- GtkBin *bin = GTK_BIN( child->data );
- if (bin->child->window == window) return TRUE;
+ gtk_widget_set_style( GTK_BIN(child->data)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
child = child->next;
}
-
- return FALSE;
}
void wxListBox::SetBackgroundColour( const wxColour &colour )
{
- wxCHECK_RET( m_list != NULL, "invalid list ctrl" );
+ return;
- m_backgroundColour = colour;
+ wxCHECK_RET( m_list != NULL, "invalid listbox" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ return;
+
if (!m_backgroundColour.Ok()) return;
- SetBackgroundColourHelper( GTK_WIDGET(m_list)->window );
-
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( GTK_WIDGET(m_list) ) );
- }
- else
- {
- style = gtk_widget_get_style( GTK_WIDGET(m_list) );
- }
-
- style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
- style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-
- gtk_widget_set_style( GTK_WIDGET(m_list), style );
-
+ gtk_widget_set_style( GTK_WIDGET(m_list),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
GList *child = m_list->children;
while (child)
{
- GtkWidget *item = GTK_WIDGET(child->data);
- gtk_widget_set_style( item,
- gtk_style_ref(
- gtk_widget_get_style( GTK_WIDGET(m_list) ) ) );
+ gtk_widget_set_style( GTK_WIDGET(child->data),
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
+ gtk_widget_set_style( GTK_BIN(child->data)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
child = child->next;
}
}
// Name: radiobox.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
SetLabel( title );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
bool wxRadioBox::Show( bool show )
{
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
+
wxWindow::Show( show );
wxNode *node = m_boxes.First();
int wxRadioBox::FindString( const wxString &s ) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
+
int count = 0;
wxNode *node = m_boxes.First();
void wxRadioBox::SetSelection( int n )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( n );
if (!node)
int wxRadioBox::GetSelection(void) const
{
+ wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
+
int count = 0;
wxNode *node = m_boxes.First();
wxString wxRadioBox::GetString( int n ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( n );
if (!node)
wxString wxRadioBox::GetLabel( int item ) const
{
+ wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
+
return GetString( item );
}
void wxRadioBox::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxControl::SetLabel( label );
- GtkFrame *frame = GTK_FRAME( m_widget );
- gtk_frame_set_label( frame, wxControl::GetLabel() );
+
+ gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
wxNode *node = m_boxes.Nth( item );
if (!node)
void wxRadioBox::SetFont( const wxFont &font )
{
- wxWindow::SetFont( font );
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
+ wxControl::SetFont( font );
wxNode *node = m_boxes.First();
while (node)
}
}
+void wxRadioBox::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
+
+ wxControl::SetBackgroundColour( colour );
+
+ if (!m_backgroundColour.Ok()) return;
+
+ wxNode *node = m_boxes.First();
+ while (node)
+ {
+ GtkWidget *button = GTK_WIDGET( node->Data() );
+
+ gtk_widget_set_style( button,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+
+ node = node->Next();
+ }
+}
+
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
if (window == m_widget->window) return TRUE;
// Name: radiobut.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
void wxRadioButton::SetLabel( const wxString& label )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
wxControl::SetLabel( label );
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
void wxRadioButton::SetValue( bool val )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
}
bool wxRadioButton::GetValue(void) const
{
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobutton" );
+
return GTK_TOGGLE_BUTTON(m_widget)->active;
}
void wxRadioButton::Enable( bool enable )
{
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
wxControl::Enable( enable );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
- gtk_widget_set_sensitive( label, enable );
+
+ gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
}
void wxRadioButton::SetFont( const wxFont &font )
{
- if (((wxFont*)&font)->Ok())
- m_font = font;
- else
- m_font = *wxSWISS_FONT;
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
- GtkButton *bin = GTK_BUTTON( m_widget );
- GtkWidget *label = bin->child;
+ wxControl::SetFont( font );
- GtkStyle *style = (GtkStyle*) NULL;
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( label ) );
- }
- else
- {
- style = gtk_widget_get_style( label );
- }
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxRadioButton::SetBackgroundColour( const wxColour &colour )
+{
+ return;
+
+ wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
+
+ wxControl::SetBackgroundColour( colour );
- gdk_font_unref( style->font );
- style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+ if (!m_backgroundColour.Ok()) return;
- gtk_widget_set_style( label, style );
+ gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
+ gtk_style_ref(
+ gtk_widget_get_style( m_widget ) ) );
}
// Name: region.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/98
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
// Name: settings.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Name: slider.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
PostCreation();
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
Show( TRUE );
return TRUE;
// Name: textctrl.cpp
// Purpose:
// Author: Robert Roebling
-// Created: 01/02/97
-// Id:
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
Show( TRUE );
+ SetBackgroundColour( parent->GetBackgroundColour() );
+
return TRUE;
}
void wxTextCtrl::SetValue( const wxString &value )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
wxString tmp = "";
if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE)
void wxTextCtrl::WriteText( const wxString &text )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE)
void wxTextCtrl::SetInsertionPointEnd()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) );
void wxTextCtrl::SetEditable( bool editable )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable );
else
void wxTextCtrl::SetSelection( long from, long to )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
{
- wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented"));
+ wxFAIL_MSG( "wxTextCtrl::ShowPosition not implemented" );
}
long wxTextCtrl::GetInsertionPoint() const
{
+ wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
+
return (long) GTK_EDITABLE(m_text)->current_pos;
}
long wxTextCtrl::GetLastPosition() const
{
+ wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
+
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) );
void wxTextCtrl::Remove( long from, long to )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}
void wxTextCtrl::Replace( long from, long to, const wxString &value )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return;
gint pos = (gint)to;
void wxTextCtrl::Cut()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::Copy()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::Paste()
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else
void wxTextCtrl::SetFont( const wxFont &font )
{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
if (((wxFont*)&font)->Ok())
m_font = font;
else
m_font = *wxSWISS_FONT;
- GtkStyle *style = (GtkStyle*) NULL;
+ GtkStyle *style = gtk_widget_get_style( m_text );
if (!m_hasOwnStyle)
{
m_hasOwnStyle = TRUE;
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
}
- else
- {
- style = gtk_widget_get_style( m_text );
- }
gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
+ return;
+
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- SetBackgroundColourHelper( GTK_TEXT(m_text)->text_area );
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ GdkWindow *window = GTK_TEXT(m_text)->text_area;
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+ gdk_window_set_background( window, m_backgroundColour.GetColor() );
+ gdk_window_clear( window );
+ }
+ else
+ {
+ GtkStyle *style = gtk_widget_get_style( m_text );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( gtk_widget_get_style( m_text ) );
+ }
+
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_text->window ) );
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_text, style );
+ }
}
+
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_hasOwnStyle = FALSE;
+ m_scrollGC = (GdkGC*) NULL;
}
void wxWindow::PostCreation()
return m_backgroundColour;
}
-void wxWindow::SetBackgroundColourHelper( GdkWindow *window )
-{
- if (!m_backgroundColour.Ok()) return;
-
- m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
- gdk_window_set_background( window, m_backgroundColour.GetColor() );
- gdk_window_clear( window );
-}
-
void wxWindow::SetBackgroundColour( const wxColour &colour )
{
wxCHECK_RET( m_widget != NULL, "invalid window" );
m_backgroundColour = colour;
+ if (!m_backgroundColour.Ok()) return;
- GtkWidget *widget = m_wxwindow == NULL ? m_widget : m_wxwindow;
- SetBackgroundColourHelper( widget->window );
+ if (m_wxwindow)
+ {
+ GdkWindow *window = m_wxwindow->window;
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+ gdk_window_set_background( window, m_backgroundColour.GetColor() );
+ gdk_window_clear( window );
+ }
+ else
+ {
+ GtkStyle *style = gtk_widget_get_style( m_widget );
+ if (!m_hasOwnStyle)
+ {
+ m_hasOwnStyle = TRUE;
+ style = gtk_style_copy( style );
+ }
+
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
+ style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+ style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+
+ gtk_widget_set_style( m_widget, style );
+ }
}
wxColour wxWindow::GetForegroundColour() const
else
m_font = *wxSWISS_FONT;
- GtkStyle *style = (GtkStyle*) NULL;
+ GtkStyle *style = gtk_widget_get_style( m_widget );
if (!m_hasOwnStyle)
{
m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
- }
- else
- {
- style = gtk_widget_get_style( m_widget );
+ style = gtk_style_copy( style );
}
gdk_font_unref( style->font );
};
case ID_TEXTCTRL_DEL:
{
- m_textctrl->Delete();
+ m_textctrl->Clear();
break;
};
};
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
{
my_bitmap = new wxBitmap( folder_xpm );
- my_horse = new wxBitmap();
- my_horse->LoadFile( "horse.png", 0 );
+// my_horse = new wxBitmap();
+// my_horse->LoadFile( "horse.png", 0 );
my_backstore = new wxBitmap( 150, 150 );
my_font = new wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL );
m_isCreated = FALSE;
{
delete my_bitmap;
delete my_backstore;
- delete my_horse;
+// delete my_horse;
delete my_font;
};
dc.DrawText( "Hej, ho, hej, ho. (ItalicFont)", 80, 100 );
dc.DrawBitmap( *my_bitmap, 30, 80, TRUE );
- dc.DrawBitmap( *my_horse, 30, 120 );
+// dc.DrawBitmap( *my_horse, 30, 120 );
dc.Blit( 200, 200, 150, 150, &memDC, 0, 0, 0 );