Added bitmaps and icons to samples
Fixed event handling in all controls Add some missing functions to wxRadioBox Fixed clientData stuff to Choice (Combo?) No more gtk warning in Combo Fixed toolbar sample and mdi sample Fixed bug in AddChild resulting from mdi changes Fixed wxFrame::GetPosition() Changed order of notification calls in wxListCtrl to prevent what I think is a reentry bug The usual compile fixes here and there git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1103,6 +1103,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
m_current = line;
|
||||
HilightAll( FALSE );
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1110,6 +1111,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
{
|
||||
m_current = line;
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
else if (event.ControlDown())
|
||||
{
|
||||
@@ -1143,21 +1145,20 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
RefreshLine( test_line );
|
||||
node = node->Next();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current = line;
|
||||
HilightAll( FALSE );
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
}
|
||||
RefreshLine( m_current );
|
||||
if (m_current != oldCurrent)
|
||||
{
|
||||
RefreshLine( oldCurrent );
|
||||
UnfocusLine( oldCurrent );
|
||||
FocusLine( m_current );
|
||||
RefreshLine( oldCurrent );
|
||||
};
|
||||
m_lastOnSame = (m_current == oldCurrent);
|
||||
return;
|
||||
@@ -1198,15 +1199,15 @@ void wxListMainWindow::MoveToFocus( void )
|
||||
|
||||
void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
|
||||
{
|
||||
UnfocusLine( m_current );
|
||||
if ((m_mode & wxLC_SINGLE_SEL) || (m_usedKeys == FALSE)) m_current->Hilight( FALSE );
|
||||
wxListLineData *oldCurrent = m_current;
|
||||
m_current = newCurrent;
|
||||
MoveToFocus();
|
||||
if (shiftDown || (m_mode & wxLC_SINGLE_SEL)) m_current->Hilight( TRUE );
|
||||
FocusLine( m_current );
|
||||
RefreshLine( m_current );
|
||||
RefreshLine( oldCurrent );
|
||||
FocusLine( m_current );
|
||||
UnfocusLine( oldCurrent );
|
||||
};
|
||||
|
||||
void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
@@ -1310,14 +1311,14 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
if (!(m_mode & wxLC_SINGLE_SEL))
|
||||
{
|
||||
wxListLineData *oldCurrent = m_current;
|
||||
UnfocusLine( m_current );
|
||||
m_current->ReverseHilight();
|
||||
wxNode *node = m_lines.Member( m_current )->Next();
|
||||
if (node) m_current = (wxListLineData*)node->Data();
|
||||
MoveToFocus();
|
||||
FocusLine( m_current );
|
||||
RefreshLine( m_current );
|
||||
RefreshLine( oldCurrent );
|
||||
RefreshLine( m_current );
|
||||
UnfocusLine( oldCurrent );
|
||||
FocusLine( m_current );
|
||||
};
|
||||
};
|
||||
break;
|
||||
@@ -1828,6 +1829,7 @@ void wxListMainWindow::DeleteColumn( int col )
|
||||
void wxListMainWindow::DeleteAllItems( void )
|
||||
{
|
||||
m_dirty = TRUE;
|
||||
m_current = NULL;
|
||||
wxNode *node = m_lines.First();
|
||||
while (node)
|
||||
{
|
||||
@@ -1836,12 +1838,12 @@ void wxListMainWindow::DeleteAllItems( void )
|
||||
node = node->Next();
|
||||
};
|
||||
m_lines.Clear();
|
||||
m_current = NULL;
|
||||
};
|
||||
|
||||
void wxListMainWindow::DeleteEverything( void )
|
||||
{
|
||||
m_dirty = TRUE;
|
||||
m_current = NULL;
|
||||
wxNode *node = m_lines.First();
|
||||
while (node)
|
||||
{
|
||||
|
@@ -26,12 +26,11 @@ class wxBitmapButton;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
||||
|
||||
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||
event.SetEventObject(button);
|
||||
button->ProcessEvent(event);
|
||||
button->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -26,12 +26,11 @@ class wxButton;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
|
||||
|
||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
|
||||
{
|
||||
wxButton *button = (wxButton*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||
event.SetEventObject(button);
|
||||
button->ProcessEvent(event);
|
||||
button->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -19,13 +19,12 @@
|
||||
// wxCheckBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||
{
|
||||
wxCheckBox *cb = (wxCheckBox*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
event.SetInt( cb->GetValue() );
|
||||
event.SetEventObject(cb);
|
||||
cb->ProcessEvent(event);
|
||||
cb->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -19,15 +19,14 @@
|
||||
// wxChoice
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
|
||||
{
|
||||
wxChoice *choice = (wxChoice*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||
event.SetInt( choice->GetSelection() );
|
||||
wxString tmp( choice->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject(choice);
|
||||
choice->ProcessEvent(event);
|
||||
choice->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -103,8 +102,8 @@ void wxChoice::Clear(void)
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
{
|
||||
// If you read this code once and you think you undestand
|
||||
// it, then you are very wrong. RR
|
||||
// If you read this code once and you think you understand
|
||||
// it, then you are very wrong. Robert Roebling.
|
||||
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
int count = 0;
|
||||
@@ -112,7 +111,8 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
while (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL(bin->child);
|
||||
GtkLabel *label = NULL;
|
||||
if (bin->child) label = GTK_LABEL(bin->child);
|
||||
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
|
||||
if (string == label->label) return count;
|
||||
child = child->next;
|
||||
@@ -151,7 +151,8 @@ wxString wxChoice::GetString( int n ) const
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
if (count == n)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL(bin->child);
|
||||
GtkLabel *label = NULL;
|
||||
if (bin->child) label = GTK_LABEL(bin->child);
|
||||
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
|
||||
return label->label;
|
||||
};
|
||||
@@ -188,6 +189,8 @@ void wxChoice::SetSelection( int n )
|
||||
{
|
||||
int tmp = n;
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||
|
||||
gtk_choice_clicked_callback( NULL, this );
|
||||
};
|
||||
|
||||
void wxChoice::SetStringSelection( const wxString &string )
|
||||
|
@@ -14,20 +14,54 @@
|
||||
|
||||
#include "wx/combobox.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern bool g_blockEventsOnDrag;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxComboBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
//-----------------------------------------------------------------------------
|
||||
// clicked
|
||||
|
||||
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (combo->m_alreadySent)
|
||||
{
|
||||
combo->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
combo->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
|
||||
event.SetInt( combo->GetSelection() );
|
||||
wxString tmp( combo->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject(combo);
|
||||
combo->ProcessEvent(event);
|
||||
combo->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// size
|
||||
|
||||
/*
|
||||
static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (!widget->button) return FALSE;
|
||||
|
||||
widget->button->allocation.x =
|
||||
alloc->width - widget->button->allocation.width;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
||||
@@ -37,6 +71,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
int n, const wxString choices[],
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
@@ -60,11 +95,18 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
};
|
||||
|
||||
PostCreation();
|
||||
|
||||
/*
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
|
||||
*/
|
||||
|
||||
if (!value.IsNull()) SetValue( value );
|
||||
|
||||
Show( TRUE );
|
||||
@@ -76,31 +118,44 @@ void wxComboBox::Clear(void)
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
|
||||
|
||||
m_clientData.Clear();
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &item )
|
||||
{
|
||||
Append( item, (char*)NULL );
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
|
||||
GtkWidget *list_item;
|
||||
list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
|
||||
{
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
};
|
||||
|
||||
void wxComboBox::Delete( int n )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), n, n );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG("wxComboBox::Delete wrong index");
|
||||
}
|
||||
else
|
||||
m_clientData.DeleteNode( node );
|
||||
};
|
||||
|
||||
int wxComboBox::FindString( const wxString &item )
|
||||
@@ -196,6 +251,13 @@ void wxComboBox::SetSelection( int n )
|
||||
gtk_list_select_item( GTK_LIST(list), n );
|
||||
};
|
||||
|
||||
void wxComboBox::SetStringSelection( const wxString &string )
|
||||
{
|
||||
int res = FindString( string );
|
||||
if (res == -1) return;
|
||||
SetSelection( res );
|
||||
};
|
||||
|
||||
wxString wxComboBox::GetValue(void) const
|
||||
{
|
||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||
|
@@ -33,7 +33,7 @@ extern wxList wxPendingDelete;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// size
|
||||
// set size
|
||||
|
||||
void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
|
||||
{
|
||||
@@ -66,6 +66,19 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// configure
|
||||
|
||||
gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
|
||||
win->m_x = event->x;
|
||||
win->m_y = event->y;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
@@ -143,6 +156,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
|
||||
GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
gtk_widget_realize( m_mainWindow );
|
||||
@@ -210,10 +226,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
};
|
||||
};
|
||||
|
||||
void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
// due to a bug in gtk, x,y are always 0
|
||||
// m_x = x;
|
||||
// m_y = y;
|
||||
|
||||
if ((m_height == height) && (m_width == width) &&
|
||||
(m_sizeSet)) return;
|
||||
@@ -240,7 +257,7 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
// m_wxwindow just like any other window.
|
||||
|
||||
// not really needed
|
||||
gtk_widget_set_usize( m_mainWindow, width, height );
|
||||
// gtk_widget_set_usize( m_mainWindow, width, height );
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
|
@@ -20,10 +20,8 @@
|
||||
// wxListBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
|
||||
void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
|
||||
{
|
||||
wxListBox *listbox = (wxListBox*)data;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||
|
||||
event.SetInt( listbox->GetIndex( widget ) );
|
||||
@@ -32,10 +30,9 @@ void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
wxString tmp( label->label );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
listbox->ProcessEvent( event );
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -22,15 +22,22 @@
|
||||
// wxRadioBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
|
||||
{
|
||||
wxRadioBox *rb = (wxRadioBox*)data;
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
rb->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->ProcessEvent(event);
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -56,6 +63,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int WXUNUSED(majorDim), long style,
|
||||
const wxString &name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
@@ -74,6 +82,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
@@ -123,13 +132,33 @@ bool wxRadioBox::Show( bool show )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
|
||||
int wxRadioBox::FindString( const wxString &s ) const
|
||||
{
|
||||
return 0;
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
|
||||
int count = g_slist_length(item)-1;
|
||||
|
||||
while (item)
|
||||
{
|
||||
GtkButton *b = GTK_BUTTON( item->data );
|
||||
GtkLabel *l = GTK_LABEL( b->child );
|
||||
if (s == l->label) return count;
|
||||
count--;
|
||||
item = item->next;
|
||||
};
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
void wxRadioBox::SetSelection( int WXUNUSED(n) )
|
||||
void wxRadioBox::SetSelection( int n )
|
||||
{
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
item = g_slist_nth( item, g_slist_length(item)-n-1 );
|
||||
if (!item) return;
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
};
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
@@ -146,9 +175,18 @@ int wxRadioBox::GetSelection(void) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
|
||||
wxString wxRadioBox::GetString( int n ) const
|
||||
{
|
||||
return "";
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
|
||||
item = g_slist_nth( item, g_slist_length(item)-n-1 );
|
||||
if (!item) return "";
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
|
||||
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
|
||||
return wxString( label->label );
|
||||
};
|
||||
|
||||
wxString wxRadioBox::GetLabel(void) const
|
||||
@@ -201,8 +239,11 @@ wxString wxRadioBox::GetStringSelection(void) const
|
||||
return "";
|
||||
};
|
||||
|
||||
bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
|
||||
bool wxRadioBox::SetStringSelection( const wxString&s )
|
||||
{
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
|
@@ -52,7 +52,7 @@ void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
|
||||
|
||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||
event.SetEventObject( win );
|
||||
win->ProcessEvent( event );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
/*
|
||||
wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
|
||||
|
@@ -59,7 +59,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
bool bMultiLine = (style & wxTE_MULTILINE) != 0;
|
||||
if ( bMultiLine ) {
|
||||
if ( bMultiLine )
|
||||
{
|
||||
// a multi-line edit control: create a vertical scrollbar by default and
|
||||
// horizontal if requested
|
||||
bool bHasHScrollbar = (style & wxHSCROLL) != 0;
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/treectrl.h"
|
||||
//#include "wx/treectrl.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include <math.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
@@ -1064,7 +1064,8 @@ void wxWindow::ImplementSetPosition(void)
|
||||
if (IsKindOf(CLASSINFO(wxFrame)) ||
|
||||
IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||
if ((m_x != -1) || (m_y != -1))
|
||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1362,7 +1363,7 @@ void wxWindow::Fit(void)
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
SetClientSize(maxX + 5, maxY + 5);
|
||||
SetClientSize(maxX + 5, maxY + 10);
|
||||
};
|
||||
|
||||
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
@@ -1473,7 +1474,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame has a private AddChild
|
||||
|
||||
if (IS_KIND_OF(this,wxFrame))
|
||||
if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
|
||||
{
|
||||
wxFrame *frame = (wxFrame*)this;
|
||||
frame->AddChild( child );
|
||||
@@ -1604,12 +1605,6 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
gdk_rect.width = rect->width;
|
||||
gdk_rect.height = rect->height;
|
||||
|
||||
if (IS_KIND_OF(this,wxTreeCtrl))
|
||||
{
|
||||
printf( "x: %d y: %d w: %d h: %d .\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
|
||||
}
|
||||
|
||||
if (m_wxwindow)
|
||||
gtk_widget_draw( m_wxwindow, &gdk_rect );
|
||||
else
|
||||
|
@@ -26,12 +26,11 @@ class wxBitmapButton;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
||||
|
||||
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||
event.SetEventObject(button);
|
||||
button->ProcessEvent(event);
|
||||
button->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -26,12 +26,11 @@ class wxButton;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
|
||||
|
||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
|
||||
{
|
||||
wxButton *button = (wxButton*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||
event.SetEventObject(button);
|
||||
button->ProcessEvent(event);
|
||||
button->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -19,13 +19,12 @@
|
||||
// wxCheckBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||
{
|
||||
wxCheckBox *cb = (wxCheckBox*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
event.SetInt( cb->GetValue() );
|
||||
event.SetEventObject(cb);
|
||||
cb->ProcessEvent(event);
|
||||
cb->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -19,15 +19,14 @@
|
||||
// wxChoice
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
|
||||
{
|
||||
wxChoice *choice = (wxChoice*)data;
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||
event.SetInt( choice->GetSelection() );
|
||||
wxString tmp( choice->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject(choice);
|
||||
choice->ProcessEvent(event);
|
||||
choice->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -103,8 +102,8 @@ void wxChoice::Clear(void)
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
{
|
||||
// If you read this code once and you think you undestand
|
||||
// it, then you are very wrong. RR
|
||||
// If you read this code once and you think you understand
|
||||
// it, then you are very wrong. Robert Roebling.
|
||||
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
int count = 0;
|
||||
@@ -112,7 +111,8 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
while (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL(bin->child);
|
||||
GtkLabel *label = NULL;
|
||||
if (bin->child) label = GTK_LABEL(bin->child);
|
||||
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
|
||||
if (string == label->label) return count;
|
||||
child = child->next;
|
||||
@@ -151,7 +151,8 @@ wxString wxChoice::GetString( int n ) const
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
if (count == n)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL(bin->child);
|
||||
GtkLabel *label = NULL;
|
||||
if (bin->child) label = GTK_LABEL(bin->child);
|
||||
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
|
||||
return label->label;
|
||||
};
|
||||
@@ -188,6 +189,8 @@ void wxChoice::SetSelection( int n )
|
||||
{
|
||||
int tmp = n;
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||
|
||||
gtk_choice_clicked_callback( NULL, this );
|
||||
};
|
||||
|
||||
void wxChoice::SetStringSelection( const wxString &string )
|
||||
|
@@ -14,20 +14,54 @@
|
||||
|
||||
#include "wx/combobox.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern bool g_blockEventsOnDrag;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxComboBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
//-----------------------------------------------------------------------------
|
||||
// clicked
|
||||
|
||||
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||
{
|
||||
if (combo->m_alreadySent)
|
||||
{
|
||||
combo->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
combo->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
|
||||
event.SetInt( combo->GetSelection() );
|
||||
wxString tmp( combo->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject(combo);
|
||||
combo->ProcessEvent(event);
|
||||
combo->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// size
|
||||
|
||||
/*
|
||||
static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (!widget->button) return FALSE;
|
||||
|
||||
widget->button->allocation.x =
|
||||
alloc->width - widget->button->allocation.width;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
||||
@@ -37,6 +71,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
int n, const wxString choices[],
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
@@ -60,11 +95,18 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
};
|
||||
|
||||
PostCreation();
|
||||
|
||||
/*
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
|
||||
*/
|
||||
|
||||
if (!value.IsNull()) SetValue( value );
|
||||
|
||||
Show( TRUE );
|
||||
@@ -76,31 +118,44 @@ void wxComboBox::Clear(void)
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
|
||||
|
||||
m_clientData.Clear();
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &item )
|
||||
{
|
||||
Append( item, (char*)NULL );
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
|
||||
GtkWidget *list_item;
|
||||
list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
};
|
||||
|
||||
void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
|
||||
{
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
};
|
||||
|
||||
void wxComboBox::Delete( int n )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), n, n );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG("wxComboBox::Delete wrong index");
|
||||
}
|
||||
else
|
||||
m_clientData.DeleteNode( node );
|
||||
};
|
||||
|
||||
int wxComboBox::FindString( const wxString &item )
|
||||
@@ -196,6 +251,13 @@ void wxComboBox::SetSelection( int n )
|
||||
gtk_list_select_item( GTK_LIST(list), n );
|
||||
};
|
||||
|
||||
void wxComboBox::SetStringSelection( const wxString &string )
|
||||
{
|
||||
int res = FindString( string );
|
||||
if (res == -1) return;
|
||||
SetSelection( res );
|
||||
};
|
||||
|
||||
wxString wxComboBox::GetValue(void) const
|
||||
{
|
||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||
|
@@ -33,7 +33,7 @@ extern wxList wxPendingDelete;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// size
|
||||
// set size
|
||||
|
||||
void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
|
||||
{
|
||||
@@ -66,6 +66,19 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// configure
|
||||
|
||||
gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
|
||||
win->m_x = event->x;
|
||||
win->m_y = event->y;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
@@ -143,6 +156,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
|
||||
GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
gtk_widget_realize( m_mainWindow );
|
||||
@@ -210,10 +226,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
};
|
||||
};
|
||||
|
||||
void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
// due to a bug in gtk, x,y are always 0
|
||||
// m_x = x;
|
||||
// m_y = y;
|
||||
|
||||
if ((m_height == height) && (m_width == width) &&
|
||||
(m_sizeSet)) return;
|
||||
@@ -240,7 +257,7 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
// m_wxwindow just like any other window.
|
||||
|
||||
// not really needed
|
||||
gtk_widget_set_usize( m_mainWindow, width, height );
|
||||
// gtk_widget_set_usize( m_mainWindow, width, height );
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
|
@@ -20,10 +20,8 @@
|
||||
// wxListBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
|
||||
void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
|
||||
{
|
||||
wxListBox *listbox = (wxListBox*)data;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||
|
||||
event.SetInt( listbox->GetIndex( widget ) );
|
||||
@@ -32,10 +30,9 @@ void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
wxString tmp( label->label );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
listbox->ProcessEvent( event );
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -22,15 +22,22 @@
|
||||
// wxRadioBox
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
|
||||
{
|
||||
wxRadioBox *rb = (wxRadioBox*)data;
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
rb->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->ProcessEvent(event);
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -56,6 +63,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int WXUNUSED(majorDim), long style,
|
||||
const wxString &name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
@@ -74,6 +82,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
@@ -123,13 +132,33 @@ bool wxRadioBox::Show( bool show )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
|
||||
int wxRadioBox::FindString( const wxString &s ) const
|
||||
{
|
||||
return 0;
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
|
||||
int count = g_slist_length(item)-1;
|
||||
|
||||
while (item)
|
||||
{
|
||||
GtkButton *b = GTK_BUTTON( item->data );
|
||||
GtkLabel *l = GTK_LABEL( b->child );
|
||||
if (s == l->label) return count;
|
||||
count--;
|
||||
item = item->next;
|
||||
};
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
void wxRadioBox::SetSelection( int WXUNUSED(n) )
|
||||
void wxRadioBox::SetSelection( int n )
|
||||
{
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
item = g_slist_nth( item, g_slist_length(item)-n-1 );
|
||||
if (!item) return;
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
};
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
@@ -146,9 +175,18 @@ int wxRadioBox::GetSelection(void) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
|
||||
wxString wxRadioBox::GetString( int n ) const
|
||||
{
|
||||
return "";
|
||||
GSList *item = gtk_radio_button_group( m_radio );
|
||||
|
||||
item = g_slist_nth( item, g_slist_length(item)-n-1 );
|
||||
if (!item) return "";
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
|
||||
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
|
||||
return wxString( label->label );
|
||||
};
|
||||
|
||||
wxString wxRadioBox::GetLabel(void) const
|
||||
@@ -201,8 +239,11 @@ wxString wxRadioBox::GetStringSelection(void) const
|
||||
return "";
|
||||
};
|
||||
|
||||
bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
|
||||
bool wxRadioBox::SetStringSelection( const wxString&s )
|
||||
{
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
|
@@ -52,7 +52,7 @@ void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
|
||||
|
||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||
event.SetEventObject( win );
|
||||
win->ProcessEvent( event );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
/*
|
||||
wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
|
||||
|
@@ -59,7 +59,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
bool bMultiLine = (style & wxTE_MULTILINE) != 0;
|
||||
if ( bMultiLine ) {
|
||||
if ( bMultiLine )
|
||||
{
|
||||
// a multi-line edit control: create a vertical scrollbar by default and
|
||||
// horizontal if requested
|
||||
bool bHasHScrollbar = (style & wxHSCROLL) != 0;
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/treectrl.h"
|
||||
//#include "wx/treectrl.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include <math.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
@@ -1064,7 +1064,8 @@ void wxWindow::ImplementSetPosition(void)
|
||||
if (IsKindOf(CLASSINFO(wxFrame)) ||
|
||||
IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||
if ((m_x != -1) || (m_y != -1))
|
||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1362,7 +1363,7 @@ void wxWindow::Fit(void)
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
SetClientSize(maxX + 5, maxY + 5);
|
||||
SetClientSize(maxX + 5, maxY + 10);
|
||||
};
|
||||
|
||||
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
@@ -1473,7 +1474,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame has a private AddChild
|
||||
|
||||
if (IS_KIND_OF(this,wxFrame))
|
||||
if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
|
||||
{
|
||||
wxFrame *frame = (wxFrame*)this;
|
||||
frame->AddChild( child );
|
||||
@@ -1604,12 +1605,6 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
gdk_rect.width = rect->width;
|
||||
gdk_rect.height = rect->height;
|
||||
|
||||
if (IS_KIND_OF(this,wxTreeCtrl))
|
||||
{
|
||||
printf( "x: %d y: %d w: %d h: %d .\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
|
||||
}
|
||||
|
||||
if (m_wxwindow)
|
||||
gtk_widget_draw( m_wxwindow, &gdk_rect );
|
||||
else
|
||||
|
Reference in New Issue
Block a user