Corrected wxlistBox, wxRadioBox, wxComboBox and
wxChoice in that they do no longer send events after programmatic calls Corrected wxStaticBitmap Reimplemented wxRadioButton as per wxMSW Updated docs for the above Update testconf for socket changes Other minor fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -99,7 +99,8 @@ Returns TRUE if it is checked, FALSE otherwise.
|
||||
|
||||
\func{void}{SetValue}{\param{const bool}{ state}}
|
||||
|
||||
Sets the checkbox to the given state.
|
||||
Sets the checkbox to the given state. This does not cause a
|
||||
wxEVT\_COMMAND\_CHECKBOX\_CLICKED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -183,7 +183,8 @@ This is implemented for Motif only.
|
||||
|
||||
\func{void}{SetSelection}{\param{int}{ n}}
|
||||
|
||||
Sets the choice by passing the desired string position.
|
||||
Sets the choice by passing the desired string position. This does not cause
|
||||
a wxEVT\_COMMAND\_CHOICE\_SELECTED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -197,7 +198,8 @@ Sets the choice by passing the desired string position.
|
||||
|
||||
\func{void}{SetStringSelection}{\param{const wxString\& }{ string}}
|
||||
|
||||
Sets the choice by passing the desired string.
|
||||
Sets the choice by passing the desired string. This does not cause
|
||||
a wxEVT\_COMMAND\_CHOICE\_SELECTED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -295,7 +295,8 @@ Sets the insertion point at the end of the combobox text field.
|
||||
|
||||
\func{void}{SetSelection}{\param{int}{ n}}
|
||||
|
||||
Selects the given item in the combobox list.
|
||||
Selects the given item in the combobox list. This does not cause a
|
||||
wxEVT\_COMMAND\_COMBOBOX\_SELECTED event to get emitted.
|
||||
|
||||
\func{void}{SetSelection}{\param{long}{ from}, \param{long}{ to}}
|
||||
|
||||
|
@@ -338,7 +338,7 @@ Associates the given client data pointer with the given item.
|
||||
|
||||
\func{void}{SetFirstItem}{\param{const wxString\& }{string}}
|
||||
|
||||
Set the specified item to be the first visible item.
|
||||
Set the specified item to be the first visible item. Windows only.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -350,7 +350,8 @@ Set the specified item to be the first visible item.
|
||||
|
||||
\func{void}{SetSelection}{\param{int}{ n}, \param{const bool }{select = TRUE}}
|
||||
|
||||
Selects or deselects the given item.
|
||||
Selects or deselects the given item. This does not cause a
|
||||
wxEVT\_COMMAND\_LISTBOX\_SELECT event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -374,7 +375,8 @@ Sets the string value of an item.
|
||||
|
||||
\func{void}{SetStringSelection}{\param{const wxString\& }{ string}, \param{const bool}{ select = TRUE}}
|
||||
|
||||
Sets the current selection.
|
||||
Sets the current selection. This does not cause a
|
||||
wxEVT\_COMMAND\_LISTBOX\_SELECT event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ Retrieves the client data pointer associated with the node.
|
||||
|
||||
Retrieves the next node (NULL if at end of list).
|
||||
|
||||
\membersection{wxNodeBase::Previous}
|
||||
\membersection{wxNodeBase::GetPrevious}
|
||||
|
||||
\func{wxNodeBase *}{GetPrevious}{\void}
|
||||
|
||||
|
@@ -219,7 +219,8 @@ implements the following methods:\par
|
||||
|
||||
\func{void}{SetSelection}{\param{int}{ n}}
|
||||
|
||||
Sets a button by passing the desired string position.
|
||||
Sets a button by passing the desired string position. This does not cause
|
||||
a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -229,7 +230,8 @@ Sets a button by passing the desired string position.
|
||||
|
||||
\func{void}{SetStringSelection}{\param{const wxString\& }{string}}
|
||||
|
||||
Sets a button by passing the desired string.
|
||||
Sets the selection to a button by passing the desired string. This does not cause
|
||||
a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -16,7 +16,10 @@ exclusive options. It has a text label next to a (usually) round button.
|
||||
|
||||
\wxheading{Window styles}
|
||||
|
||||
There are no specific styles for this class.
|
||||
\twocolwidtha{5cm}
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\windowstyle{wxRB\_GROUP}}{Marks the beginning of a new group of radio buttons.}
|
||||
\end{twocollist}
|
||||
|
||||
See also \helpref{window styles overview}{windowstyles}.
|
||||
|
||||
@@ -98,7 +101,8 @@ Returns TRUE if the radio button is depressed, FALSE otherwise.
|
||||
|
||||
\func{void}{SetValue}{\param{const bool}{ value}}
|
||||
|
||||
Sets the radio button to selected or deselected status.
|
||||
Sets the radio button to selected or deselected status. This does not cause a
|
||||
wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED event to get emitted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -128,7 +128,6 @@ wx_include_HEADERS = \
|
||||
resource.h \
|
||||
sashwin.h \
|
||||
sckaddr.h \
|
||||
sckint.h \
|
||||
sckipc.h \
|
||||
sckstrm.h \
|
||||
scrolbar.h \
|
||||
|
@@ -1421,6 +1421,7 @@ typedef int gint;
|
||||
typedef unsigned guint;
|
||||
typedef unsigned long gulong;
|
||||
typedef void* gpointer;
|
||||
typedef struct _GSList GSList;
|
||||
|
||||
/* Stand-ins for GDK types */
|
||||
typedef gulong GdkAtom;
|
||||
|
@@ -71,7 +71,6 @@ public:
|
||||
// implementation
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
bool m_blockFirstEvent;
|
||||
GtkWidget *m_widgetCheckbox;
|
||||
GtkWidget *m_widgetLabel;
|
||||
};
|
||||
|
@@ -93,6 +93,8 @@ public:
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
void ApplyWidgetStyle();
|
||||
};
|
||||
|
@@ -117,6 +117,8 @@ public:
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
@@ -109,6 +109,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
int GetIndex( GtkWidget *item ) const;
|
||||
GtkWidget *GetConnectWidget();
|
||||
|
@@ -96,6 +96,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
wxSize LayoutItems();
|
||||
|
@@ -41,36 +41,34 @@ extern const char* wxRadioButtonNameStr;
|
||||
|
||||
class wxRadioButton: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
|
||||
public:
|
||||
inline wxRadioButton() {}
|
||||
inline wxRadioButton( wxWindow *parent, wxWindowID id,
|
||||
public:
|
||||
inline wxRadioButton() {}
|
||||
inline wxRadioButton( wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr )
|
||||
{
|
||||
{
|
||||
Create( parent, id, label, pos, size, style, validator, name );
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr );
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const;
|
||||
bool Enable( bool enable );
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const;
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
bool m_blockFirstEvent;
|
||||
GtkWidget* m_theOtherRadioButtton;
|
||||
GSList *m_radioButtonGroup;
|
||||
void ApplyWidgetStyle();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -187,6 +187,7 @@ public:
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_isStaticBox:1; /* faster than IS_KIND_OF */
|
||||
bool m_isRadioButton:1; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame:1; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus:1; /* ! wxStaticBox etc. */
|
||||
|
||||
|
@@ -71,7 +71,6 @@ public:
|
||||
// implementation
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
bool m_blockFirstEvent;
|
||||
GtkWidget *m_widgetCheckbox;
|
||||
GtkWidget *m_widgetLabel;
|
||||
};
|
||||
|
@@ -93,6 +93,8 @@ public:
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
void ApplyWidgetStyle();
|
||||
};
|
||||
|
@@ -117,6 +117,8 @@ public:
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
@@ -109,6 +109,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
void AppendCommon( const wxString &item );
|
||||
int GetIndex( GtkWidget *item ) const;
|
||||
GtkWidget *GetConnectWidget();
|
||||
|
@@ -96,6 +96,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
void DisableEvents();
|
||||
void EnableEvents();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
wxSize LayoutItems();
|
||||
|
@@ -41,36 +41,34 @@ extern const char* wxRadioButtonNameStr;
|
||||
|
||||
class wxRadioButton: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
|
||||
public:
|
||||
inline wxRadioButton() {}
|
||||
inline wxRadioButton( wxWindow *parent, wxWindowID id,
|
||||
public:
|
||||
inline wxRadioButton() {}
|
||||
inline wxRadioButton( wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr )
|
||||
{
|
||||
{
|
||||
Create( parent, id, label, pos, size, style, validator, name );
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr );
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const;
|
||||
bool Enable( bool enable );
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const;
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
bool m_blockFirstEvent;
|
||||
GtkWidget* m_theOtherRadioButtton;
|
||||
GSList *m_radioButtonGroup;
|
||||
void ApplyWidgetStyle();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -187,6 +187,7 @@ public:
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_isStaticBox:1; /* faster than IS_KIND_OF */
|
||||
bool m_isRadioButton:1; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame:1; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus:1; /* ! wxStaticBox etc. */
|
||||
|
||||
|
@@ -398,13 +398,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
(void)new wxButton( panel, ID_CHOICE_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||
(void)new wxCheckBox( panel, ID_CHOICE_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
||||
|
||||
/*
|
||||
wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
|
||||
wxSize sizeIcon = wxSize(icon.GetWidth(), icon.GetHeight());
|
||||
|
||||
wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60), sizeIcon);
|
||||
|
||||
// this doesn't work under wxGTK
|
||||
bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60), sizeIcon);
|
||||
(void)new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60), sizeIcon);
|
||||
wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60), sizeIcon);
|
||||
bitmap->SetBitmap(icon);
|
||||
*/
|
||||
wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
|
||||
(void)new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60) );
|
||||
wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60) );
|
||||
bitmap->SetBitmap(icon);
|
||||
|
||||
m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
|
||||
@@ -494,8 +497,8 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event )
|
||||
if ( selOld == 2 && selNew == 4 )
|
||||
{
|
||||
wxMessageBox("This demonstrates how a program may prevent the "
|
||||
"page change from taking place - the current page will "
|
||||
"stay the third one", "Conntrol sample",
|
||||
"page change from taking place - \n the current page will "
|
||||
"stay the third one", "Control sample",
|
||||
wxICON_INFORMATION | wxOK);
|
||||
|
||||
event.Veto();
|
||||
|
@@ -341,7 +341,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
ptr[poffset + 1] = cmap[aByte].g;
|
||||
ptr[poffset + 2] = cmap[aByte].b;
|
||||
column++;
|
||||
linepos += size;
|
||||
// linepos += size; seems to be wrong, RR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,12 +42,6 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
|
||||
|
||||
if (!cb->m_hasVMT) return;
|
||||
|
||||
if (cb->m_blockFirstEvent)
|
||||
{
|
||||
cb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
@@ -80,8 +74,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator( validator );
|
||||
#endif
|
||||
@@ -102,7 +94,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
||||
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3);
|
||||
|
||||
// VZ: why do I have to do this to make them appear?
|
||||
gtk_widget_show( m_widgetLabel );
|
||||
gtk_widget_show( m_widgetCheckbox );
|
||||
}
|
||||
@@ -146,14 +137,19 @@ void wxCheckBox::SetValue( bool state )
|
||||
{
|
||||
wxCHECK_RET( m_widgetCheckbox != NULL, _T("invalid checkbox") );
|
||||
|
||||
if ( state == GetValue() )
|
||||
if (state == GetValue())
|
||||
return;
|
||||
|
||||
// for compatibility with wxMSW don't send notification when the check box
|
||||
// state is changed programmatically
|
||||
m_blockFirstEvent = TRUE;
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widgetCheckbox),
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||
(gpointer *)this );
|
||||
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||
(gpointer *)this );
|
||||
}
|
||||
|
||||
bool wxCheckBox::GetValue() const
|
||||
|
@@ -355,8 +355,6 @@ void wxChoice::SetSelection( int n )
|
||||
|
||||
int tmp = n;
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||
|
||||
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
|
||||
}
|
||||
|
||||
void wxChoice::SetStringSelection( const wxString &string )
|
||||
@@ -367,6 +365,36 @@ void wxChoice::SetStringSelection( const wxString &string )
|
||||
if (n != -1) SetSelection( n );
|
||||
}
|
||||
|
||||
void wxChoice::DisableEvents()
|
||||
{
|
||||
/*
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT( child->data ),
|
||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxChoice::EnableEvents()
|
||||
{
|
||||
/*
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT( child->data ), "activate",
|
||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxChoice::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
|
@@ -422,8 +422,12 @@ void wxComboBox::SetSelection( int n )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid combobox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_select_item( GTK_LIST(list), n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
void wxComboBox::SetStringSelection( const wxString &string )
|
||||
@@ -586,6 +590,32 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxComboBox::DisableEvents()
|
||||
{
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboBox::EnableEvents()
|
||||
{
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||
{
|
||||
event.Skip();
|
||||
|
@@ -939,6 +939,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
}
|
||||
}
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
char *real_req_dash = new char[req_nb_dash];
|
||||
@@ -955,6 +956,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
gdk_gc_set_dashes( m_penGC, 0, (char*)req_dash, req_nb_dash );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
|
@@ -640,7 +640,11 @@ void wxListBox::Deselect( int n )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
gtk_list_unselect_item( m_list, n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
int wxListBox::FindString( const wxString &item ) const
|
||||
@@ -799,10 +803,14 @@ void wxListBox::SetSelection( int n, bool select )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
if (select)
|
||||
gtk_list_select_item( m_list, n );
|
||||
else
|
||||
gtk_list_unselect_item( m_list, n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
void wxListBox::SetString( int n, const wxString &string )
|
||||
@@ -859,7 +867,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL );
|
||||
gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
@@ -898,6 +906,38 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxListBox::DisableEvents()
|
||||
{
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (HasFlag(wxLB_MULTIPLE))
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxListBox::EnableEvents()
|
||||
{
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (HasFlag(wxLB_MULTIPLE))
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *wxListBox::GetConnectWidget()
|
||||
{
|
||||
return GTK_WIDGET(m_list);
|
||||
|
@@ -328,7 +328,11 @@ void wxRadioBox::SetSelection( int n )
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
@@ -494,6 +498,30 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
|
||||
wxFAIL_MSG(_T("wxRadioBox::SetNumberOfRowsOrCols not implemented."));
|
||||
}
|
||||
|
||||
void wxRadioBox::DisableEvents()
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(node->Data()),
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::EnableEvents()
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(node->Data()), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
|
@@ -43,12 +43,6 @@ void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButto
|
||||
|
||||
if (!rb->m_hasVMT) return;
|
||||
|
||||
if (rb->m_blockFirstEvent)
|
||||
{
|
||||
rb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
|
||||
@@ -73,22 +67,50 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
||||
wxSize newSize = size;
|
||||
|
||||
PreCreation( parent, id, pos, newSize, style, name );
|
||||
|
||||
m_isRadioButton = TRUE;
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator( validator );
|
||||
#endif
|
||||
|
||||
m_widget = gtk_radio_button_new_with_label( (GSList *) NULL, label.mbc_str() );
|
||||
|
||||
if (HasFlag(wxRB_GROUP))
|
||||
{
|
||||
/* start a new group */
|
||||
m_radioButtonGroup = (GSList*) NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* search backward for last group start */
|
||||
wxRadioButton *chief = (wxRadioButton*) NULL;
|
||||
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = node->GetData();
|
||||
if (child->m_isRadioButton)
|
||||
{
|
||||
chief = (wxRadioButton*) child;
|
||||
if (child->HasFlag(wxRB_GROUP)) break;
|
||||
}
|
||||
if (chief)
|
||||
{
|
||||
/* we are part of the group started by chief */
|
||||
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* start a new group */
|
||||
m_radioButtonGroup = (GSList*) NULL;
|
||||
}
|
||||
node = node->GetPrevious();
|
||||
}
|
||||
}
|
||||
|
||||
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
||||
|
||||
m_theOtherRadioButtton =
|
||||
gtk_radio_button_new_with_label(
|
||||
gtk_radio_button_group( GTK_RADIO_BUTTON(m_widget) ),
|
||||
"button2" );
|
||||
|
||||
SetLabel(label);
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
@@ -123,15 +145,23 @@ void wxRadioButton::SetValue( bool val )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") );
|
||||
|
||||
if ( val == GetValue() )
|
||||
if (val == GetValue())
|
||||
return;
|
||||
|
||||
m_blockFirstEvent = TRUE;
|
||||
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
if (val)
|
||||
{
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
|
||||
}
|
||||
else
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE );
|
||||
{
|
||||
// should give an assert
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
}
|
||||
|
||||
bool wxRadioButton::GetValue() const
|
||||
|
@@ -44,6 +44,11 @@ void wxStaticBitmap::CreatePixmapWidget()
|
||||
mask = m_bitmap.GetMask()->GetBitmap();
|
||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||
|
||||
/* insert GTK representation */
|
||||
(*m_parent->m_insertCallback)(m_parent, this);
|
||||
|
||||
gtk_widget_show( m_widget );
|
||||
|
||||
PostCreation();
|
||||
}
|
||||
|
||||
@@ -61,7 +66,10 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
CreatePixmapWidget();
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if ( m_bitmap.GetMask() )
|
||||
mask = m_bitmap.GetMask()->GetBitmap();
|
||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
|
||||
@@ -70,9 +78,9 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
else
|
||||
{
|
||||
m_widget = gtk_label_new( "Bitmap" );
|
||||
}
|
||||
|
||||
PostCreation();
|
||||
PostCreation();
|
||||
}
|
||||
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
@@ -88,18 +96,22 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
if ( !hasWidget )
|
||||
if (!hasWidget)
|
||||
{
|
||||
gtk_widget_destroy( m_widget );
|
||||
|
||||
// recreate m_widget because we'd created a label and not a bitmap
|
||||
// above
|
||||
/* recreate m_widget because we've created a label
|
||||
and not a bitmap above */
|
||||
CreatePixmapWidget();
|
||||
}
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||
else
|
||||
{
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||
}
|
||||
|
||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1799,6 +1799,7 @@ void wxWindow::Init()
|
||||
m_insertCallback = (wxInsertChildFunction) NULL;
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_isRadioButton = FALSE;
|
||||
m_acceptsFocus = FALSE;
|
||||
}
|
||||
|
||||
|
@@ -42,12 +42,6 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
|
||||
|
||||
if (!cb->m_hasVMT) return;
|
||||
|
||||
if (cb->m_blockFirstEvent)
|
||||
{
|
||||
cb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
@@ -80,8 +74,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator( validator );
|
||||
#endif
|
||||
@@ -102,7 +94,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
||||
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3);
|
||||
|
||||
// VZ: why do I have to do this to make them appear?
|
||||
gtk_widget_show( m_widgetLabel );
|
||||
gtk_widget_show( m_widgetCheckbox );
|
||||
}
|
||||
@@ -146,14 +137,19 @@ void wxCheckBox::SetValue( bool state )
|
||||
{
|
||||
wxCHECK_RET( m_widgetCheckbox != NULL, _T("invalid checkbox") );
|
||||
|
||||
if ( state == GetValue() )
|
||||
if (state == GetValue())
|
||||
return;
|
||||
|
||||
// for compatibility with wxMSW don't send notification when the check box
|
||||
// state is changed programmatically
|
||||
m_blockFirstEvent = TRUE;
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widgetCheckbox),
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||
(gpointer *)this );
|
||||
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||
(gpointer *)this );
|
||||
}
|
||||
|
||||
bool wxCheckBox::GetValue() const
|
||||
|
@@ -355,8 +355,6 @@ void wxChoice::SetSelection( int n )
|
||||
|
||||
int tmp = n;
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||
|
||||
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
|
||||
}
|
||||
|
||||
void wxChoice::SetStringSelection( const wxString &string )
|
||||
@@ -367,6 +365,36 @@ void wxChoice::SetStringSelection( const wxString &string )
|
||||
if (n != -1) SetSelection( n );
|
||||
}
|
||||
|
||||
void wxChoice::DisableEvents()
|
||||
{
|
||||
/*
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT( child->data ),
|
||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxChoice::EnableEvents()
|
||||
{
|
||||
/*
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT( child->data ), "activate",
|
||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxChoice::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
|
@@ -422,8 +422,12 @@ void wxComboBox::SetSelection( int n )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid combobox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_select_item( GTK_LIST(list), n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
void wxComboBox::SetStringSelection( const wxString &string )
|
||||
@@ -586,6 +590,32 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxComboBox::DisableEvents()
|
||||
{
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboBox::EnableEvents()
|
||||
{
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||
{
|
||||
event.Skip();
|
||||
|
@@ -939,6 +939,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
}
|
||||
}
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (req_dash && req_nb_dash)
|
||||
{
|
||||
char *real_req_dash = new char[req_nb_dash];
|
||||
@@ -955,6 +956,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
gdk_gc_set_dashes( m_penGC, 0, (char*)req_dash, req_nb_dash );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
|
@@ -640,7 +640,11 @@ void wxListBox::Deselect( int n )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
gtk_list_unselect_item( m_list, n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
int wxListBox::FindString( const wxString &item ) const
|
||||
@@ -799,10 +803,14 @@ void wxListBox::SetSelection( int n, bool select )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
if (select)
|
||||
gtk_list_select_item( m_list, n );
|
||||
else
|
||||
gtk_list_unselect_item( m_list, n );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
void wxListBox::SetString( int n, const wxString &string )
|
||||
@@ -859,7 +867,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL );
|
||||
gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
@@ -898,6 +906,38 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxListBox::DisableEvents()
|
||||
{
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (HasFlag(wxLB_MULTIPLE))
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxListBox::EnableEvents()
|
||||
{
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (HasFlag(wxLB_MULTIPLE))
|
||||
gtk_signal_connect( GTK_OBJECT(child->data), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *wxListBox::GetConnectWidget()
|
||||
{
|
||||
return GTK_WIDGET(m_list);
|
||||
|
@@ -328,7 +328,11 @@ void wxRadioBox::SetSelection( int n )
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
|
||||
DisableEvents();
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
@@ -494,6 +498,30 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
|
||||
wxFAIL_MSG(_T("wxRadioBox::SetNumberOfRowsOrCols not implemented."));
|
||||
}
|
||||
|
||||
void wxRadioBox::DisableEvents()
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(node->Data()),
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::EnableEvents()
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(node->Data()), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
|
@@ -43,12 +43,6 @@ void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButto
|
||||
|
||||
if (!rb->m_hasVMT) return;
|
||||
|
||||
if (rb->m_blockFirstEvent)
|
||||
{
|
||||
rb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
|
||||
@@ -73,22 +67,50 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
||||
wxSize newSize = size;
|
||||
|
||||
PreCreation( parent, id, pos, newSize, style, name );
|
||||
|
||||
m_isRadioButton = TRUE;
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator( validator );
|
||||
#endif
|
||||
|
||||
m_widget = gtk_radio_button_new_with_label( (GSList *) NULL, label.mbc_str() );
|
||||
|
||||
if (HasFlag(wxRB_GROUP))
|
||||
{
|
||||
/* start a new group */
|
||||
m_radioButtonGroup = (GSList*) NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* search backward for last group start */
|
||||
wxRadioButton *chief = (wxRadioButton*) NULL;
|
||||
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = node->GetData();
|
||||
if (child->m_isRadioButton)
|
||||
{
|
||||
chief = (wxRadioButton*) child;
|
||||
if (child->HasFlag(wxRB_GROUP)) break;
|
||||
}
|
||||
if (chief)
|
||||
{
|
||||
/* we are part of the group started by chief */
|
||||
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* start a new group */
|
||||
m_radioButtonGroup = (GSList*) NULL;
|
||||
}
|
||||
node = node->GetPrevious();
|
||||
}
|
||||
}
|
||||
|
||||
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
||||
|
||||
m_theOtherRadioButtton =
|
||||
gtk_radio_button_new_with_label(
|
||||
gtk_radio_button_group( GTK_RADIO_BUTTON(m_widget) ),
|
||||
"button2" );
|
||||
|
||||
SetLabel(label);
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
@@ -123,15 +145,23 @@ void wxRadioButton::SetValue( bool val )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") );
|
||||
|
||||
if ( val == GetValue() )
|
||||
if (val == GetValue())
|
||||
return;
|
||||
|
||||
m_blockFirstEvent = TRUE;
|
||||
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
if (val)
|
||||
{
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE );
|
||||
}
|
||||
else
|
||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE );
|
||||
{
|
||||
// should give an assert
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
}
|
||||
|
||||
bool wxRadioButton::GetValue() const
|
||||
|
@@ -44,6 +44,11 @@ void wxStaticBitmap::CreatePixmapWidget()
|
||||
mask = m_bitmap.GetMask()->GetBitmap();
|
||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||
|
||||
/* insert GTK representation */
|
||||
(*m_parent->m_insertCallback)(m_parent, this);
|
||||
|
||||
gtk_widget_show( m_widget );
|
||||
|
||||
PostCreation();
|
||||
}
|
||||
|
||||
@@ -61,7 +66,10 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
CreatePixmapWidget();
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if ( m_bitmap.GetMask() )
|
||||
mask = m_bitmap.GetMask()->GetBitmap();
|
||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
|
||||
@@ -70,9 +78,9 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
else
|
||||
{
|
||||
m_widget = gtk_label_new( "Bitmap" );
|
||||
}
|
||||
|
||||
PostCreation();
|
||||
PostCreation();
|
||||
}
|
||||
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
@@ -88,18 +96,22 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
if ( !hasWidget )
|
||||
if (!hasWidget)
|
||||
{
|
||||
gtk_widget_destroy( m_widget );
|
||||
|
||||
// recreate m_widget because we'd created a label and not a bitmap
|
||||
// above
|
||||
/* recreate m_widget because we've created a label
|
||||
and not a bitmap above */
|
||||
CreatePixmapWidget();
|
||||
}
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||
else
|
||||
{
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||
}
|
||||
|
||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1799,6 +1799,7 @@ void wxWindow::Init()
|
||||
m_insertCallback = (wxInsertChildFunction) NULL;
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_isRadioButton = FALSE;
|
||||
m_acceptsFocus = FALSE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user