void MyPanel::OnListBox( wxCommandEvent &event )
{
- m_text->AppendText( "ListBox selection string is: " );
+ m_text->AppendText( "ListBox event selection string is: " );
m_text->AppendText( event.GetString() );
m_text->AppendText( "\n" );
+ m_text->AppendText( "ListBox control selection string is: " );
+ m_text->AppendText( m_listbox->GetStringSelection() );
+ m_text->AppendText( "\n" );
}
void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event )
void MyPanel::OnChoice( wxCommandEvent &event )
{
- m_text->AppendText( "Choice selection string is: " );
+ m_text->AppendText( "Choice event selection string is: " );
m_text->AppendText( event.GetString() );
m_text->AppendText( "\n" );
+ m_text->AppendText( "Choice control selection string is: " );
+ m_text->AppendText( m_choice->GetStringSelection() );
+ m_text->AppendText( "\n" );
}
void MyPanel::OnChoiceButtons( wxCommandEvent &event )
void MyPanel::OnCombo( wxCommandEvent &event )
{
- m_text->AppendText( "ComboBox selection string is: " );
+ m_text->AppendText( "ComboBox event selection string is: " );
m_text->AppendText( event.GetString() );
m_text->AppendText( "\n" );
+ m_text->AppendText( "ComboBox control selection string is: " );
+ m_text->AppendText( m_combo->GetStringSelection() );
+ m_text->AppendText( "\n" );
}
void MyPanel::OnComboButtons( wxCommandEvent &event )
for (int i = 0; i < n; i++)
{
+ /* don't send first event, which GTK sends aways when
+ inserting the first item */
+ m_alreadySent = TRUE;
+
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
m_clientDataList.Append( (wxObject*)NULL );
gtk_container_add( GTK_CONTAINER(list), list_item );
- gtk_widget_show( list_item );
-
gtk_signal_connect( GTK_OBJECT(list_item), "select",
- GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+
+ gtk_widget_show( list_item );
}
m_parent->AddChild( this );
gtk_selection_data_set( selection_data,
selection_data->target,
- 8, /* 8-bit */
+ 8, // 8-bit
buffer,
data_size );
m_waiting = TRUE;
+ GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
+// wxPrintf( _T("atom id: %d.\n"), (int)atom );
+
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
- gtk_target_list_add( target_list, gdk_atom_intern( "STRING", FALSE ), 0, 0 );
+ gtk_target_list_add( target_list, atom, 0, 0 );
GdkEventMotion event;
event.window = m_widget->window;
event.x = x;
event.y = y;
event.state = state;
+ event.time = GDK_CURRENT_TIME;
/* GTK wants to know which button was pressed which caused the dragging */
int button_number = 0;
0,
0 );
- while (m_waiting) wxYield();
+ while (m_waiting) gtk_main_iteration();;
}
g_blockEventsOnDrag = FALSE;
m_oldPos = 0.0;
if (style & wxSL_VERTICAL)
- m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
- else
m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
if (style & wxSL_LABELS)
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
else
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
-
+
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
gtk_signal_connect( GTK_OBJECT(m_adjust),
m_needParent = TRUE;
wxSize new_size = size;
- new_size.x = 16;
+ new_size.x = 15;
if (new_size.y == -1)
new_size.y = 30;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid spin button") );
- m_width = 16;
+ m_width = 15;
gtk_widget_set_usize( m_widget, m_width, m_height );
}
if (multi_line)
{
- gtk_widget_realize(m_text);
+// gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y );
if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
+ {
+/*
+ GtkAllocation alloc;
+ alloc.x = m_x;
+ alloc.y = m_y;
+ alloc.width = m_width;
+ alloc.height = m_height;
+ gtk_widget_size_allocate( m_widget, &alloc );
+*/
+ gtk_widget_set_usize( m_widget, m_width, m_height );
+ }
}
}
for (int i = 0; i < n; i++)
{
+ /* don't send first event, which GTK sends aways when
+ inserting the first item */
+ m_alreadySent = TRUE;
+
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
m_clientDataList.Append( (wxObject*)NULL );
gtk_container_add( GTK_CONTAINER(list), list_item );
- gtk_widget_show( list_item );
-
gtk_signal_connect( GTK_OBJECT(list_item), "select",
- GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
+
+ gtk_widget_show( list_item );
}
m_parent->AddChild( this );
gtk_selection_data_set( selection_data,
selection_data->target,
- 8, /* 8-bit */
+ 8, // 8-bit
buffer,
data_size );
m_waiting = TRUE;
+ GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
+// wxPrintf( _T("atom id: %d.\n"), (int)atom );
+
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
- gtk_target_list_add( target_list, gdk_atom_intern( "STRING", FALSE ), 0, 0 );
+ gtk_target_list_add( target_list, atom, 0, 0 );
GdkEventMotion event;
event.window = m_widget->window;
event.x = x;
event.y = y;
event.state = state;
+ event.time = GDK_CURRENT_TIME;
/* GTK wants to know which button was pressed which caused the dragging */
int button_number = 0;
0,
0 );
- while (m_waiting) wxYield();
+ while (m_waiting) gtk_main_iteration();;
}
g_blockEventsOnDrag = FALSE;
m_oldPos = 0.0;
if (style & wxSL_VERTICAL)
- m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
- else
m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
if (style & wxSL_LABELS)
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
else
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
-
+
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
gtk_signal_connect( GTK_OBJECT(m_adjust),
m_needParent = TRUE;
wxSize new_size = size;
- new_size.x = 16;
+ new_size.x = 15;
if (new_size.y == -1)
new_size.y = 30;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid spin button") );
- m_width = 16;
+ m_width = 15;
gtk_widget_set_usize( m_widget, m_width, m_height );
}
if (multi_line)
{
- gtk_widget_realize(m_text);
+// gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y );
if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
+ {
+/*
+ GtkAllocation alloc;
+ alloc.x = m_x;
+ alloc.y = m_y;
+ alloc.width = m_width;
+ alloc.height = m_height;
+ gtk_widget_size_allocate( m_widget, &alloc );
+*/
+ gtk_widget_set_usize( m_widget, m_width, m_height );
+ }
}
}
#include <sched.h>
#endif
+#ifdef __WXGTK12__
+#include "gtk/gtk.h"
+#endif
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// the key for the pointer to the associated wxThread object
static pthread_key_t gs_keySelf;
+#ifndef __WXGTK12__
// this mutex must be acquired before any call to a GUI function
static wxMutex *gs_mutexGui;
+#endif
// ============================================================================
// implementation
return FALSE;
}
+#ifndef __WXGTK12__
gs_mutexGui = new wxMutex();
-
- //wxThreadGuiInit();
+#endif
gs_tidMain = pthread_self();
+
+#ifndef __WXGTK12__
gs_mutexGui->Lock();
+#endif
return TRUE;
}
gs_allThreads[n]->Delete();
}
+#ifndef __WXGTK12__
// destroy GUI mutex
gs_mutexGui->Unlock();
- //wxThreadGuiExit();
-
delete gs_mutexGui;
+#endif
// and free TLD slot
(void)pthread_key_delete(gs_keySelf);
void wxMutexGuiEnter()
{
+#ifdef __WXGTK12__
+ gdk_threads_enter();
+#else
gs_mutexGui->Lock();
+#endif
}
void wxMutexGuiLeave()
{
+#ifdef __WXGTK12__
+ gdk_threads_leave();
+#else
gs_mutexGui->Unlock();
+#endif
}
#endif