Added wxCommandEvent::IsSeection for listbox,
Applied patch for wxListBox::Set when sorting Added new value rounding code (corrected for negative values) to scrollbar and slider Added ...TEXT_CHANGED event to wxSpinCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -415,6 +415,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
|||||||
memdc.SelectObject(bitmap);
|
memdc.SelectObject(bitmap);
|
||||||
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
|
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
|
||||||
memdc.SelectObject(wxNullBitmap);
|
memdc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
wxImage image(bitmap);
|
wxImage image(bitmap);
|
||||||
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
|
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -251,14 +251,19 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
|||||||
// "select" and "deselect"
|
// "select" and "deselect"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox );
|
static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection );
|
||||||
|
|
||||||
|
static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
|
||||||
|
{
|
||||||
|
gtk_listitem_select_cb( widget, listbox, TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox )
|
static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
gtk_listitem_select_callback( widget, listbox );
|
gtk_listitem_select_cb( widget, listbox, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox )
|
static void gtk_listitem_select_cb( GtkWidget *WXUNUSED(widget), wxListBox *listbox, bool is_selection )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -267,6 +272,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
event.SetExtraLong( (long) is_selection );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int n, count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
@@ -430,24 +436,47 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") );
|
wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
size_t nItems = items.GetCount();
|
size_t nItems = items.GetCount();
|
||||||
|
int index;
|
||||||
|
|
||||||
if (pos == length)
|
if (m_strings)
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < nItems; n++ )
|
for (size_t n = 0; n < nItems; n++)
|
||||||
{
|
{
|
||||||
GtkAddItem( items[n] );
|
index = m_strings->Add( items[n] );
|
||||||
|
|
||||||
m_clientList.Append((wxObject *)NULL);
|
if (index != GetCount())
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n], index );
|
||||||
|
wxNode *node = m_clientList.Nth( index );
|
||||||
|
m_clientList.Insert( node, (wxObject*) NULL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n] );
|
||||||
|
m_clientList.Append( (wxObject*) NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxNode *node = m_clientList.Nth( pos );
|
if (pos == length)
|
||||||
for ( size_t n = 0; n < nItems; n++ )
|
|
||||||
{
|
{
|
||||||
GtkAddItem( items[n], pos+n );
|
for ( size_t n = 0; n < nItems; n++ )
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n] );
|
||||||
|
|
||||||
m_clientList.Insert( node, (wxObject *)NULL );
|
m_clientList.Append((wxObject *)NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxNode *node = m_clientList.Nth( pos );
|
||||||
|
for ( size_t n = 0; n < nItems; n++ )
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n], pos+n );
|
||||||
|
|
||||||
|
m_clientList.Insert( node, (wxObject *)NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,7 +63,8 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust, wxScrollBar *win )
|
|||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
||||||
|
|
||||||
int value = (int)ceil(adjust->value);
|
double dvalue = adjust->value;
|
||||||
|
int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5);
|
||||||
|
|
||||||
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
|
||||||
|
|
||||||
wxScrollBar::~wxScrollBar(void)
|
wxScrollBar::~wxScrollBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
!CreateBase( parent, id, pos, size, style, validator, name ))
|
!CreateBase( parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxScrollBar creation failed") );
|
wxFAIL_MSG( wxT("wxScrollBar creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_oldPos = 0.0;
|
m_oldPos = 0.0;
|
||||||
@@ -182,9 +183,10 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition(void) const
|
int wxScrollBar::GetThumbPosition() const
|
||||||
{
|
{
|
||||||
return (int)(m_adjust->value+0.5);
|
double val = m_adjust->value;
|
||||||
|
return (int)(val >= 0 ? val - 0.5 : val + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbSize() const
|
int wxScrollBar::GetThumbSize() const
|
||||||
@@ -252,7 +254,7 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Backward compatibility */
|
/* Backward compatibility */
|
||||||
int wxScrollBar::GetValue(void) const
|
int wxScrollBar::GetValue() const
|
||||||
{
|
{
|
||||||
return GetThumbPosition();
|
return GetThumbPosition();
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,8 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win )
|
|||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
||||||
|
|
||||||
int value = (int)ceil(adjust->value);
|
double dvalue = adjust->value;
|
||||||
|
int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5);
|
||||||
|
|
||||||
int orient = wxHORIZONTAL;
|
int orient = wxHORIZONTAL;
|
||||||
if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
|
if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
|
||||||
|
@@ -55,6 +55,24 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "changed"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win )
|
||||||
|
{
|
||||||
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
event.SetInt( win->GetValue() );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxSpinCtrl
|
// wxSpinCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -125,6 +143,9 @@ void wxSpinCtrl::GtkDisableEvents()
|
|||||||
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
|
GTK_SIGNAL_FUNC(gtk_spinctrl_text_changed_callback),
|
||||||
|
(gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinCtrl::GtkEnableEvents()
|
void wxSpinCtrl::GtkEnableEvents()
|
||||||
@@ -133,6 +154,11 @@ void wxSpinCtrl::GtkEnableEvents()
|
|||||||
"value_changed",
|
"value_changed",
|
||||||
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
|
"changed",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_spinctrl_text_changed_callback),
|
||||||
|
(gpointer)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSpinCtrl::GetMin() const
|
int wxSpinCtrl::GetMin() const
|
||||||
|
@@ -415,6 +415,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
|||||||
memdc.SelectObject(bitmap);
|
memdc.SelectObject(bitmap);
|
||||||
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
|
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
|
||||||
memdc.SelectObject(wxNullBitmap);
|
memdc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
wxImage image(bitmap);
|
wxImage image(bitmap);
|
||||||
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
|
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -251,14 +251,19 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
|||||||
// "select" and "deselect"
|
// "select" and "deselect"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox );
|
static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection );
|
||||||
|
|
||||||
|
static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
|
||||||
|
{
|
||||||
|
gtk_listitem_select_cb( widget, listbox, TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox )
|
static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
gtk_listitem_select_callback( widget, listbox );
|
gtk_listitem_select_cb( widget, listbox, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox )
|
static void gtk_listitem_select_cb( GtkWidget *WXUNUSED(widget), wxListBox *listbox, bool is_selection )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -267,6 +272,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
event.SetExtraLong( (long) is_selection );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int n, count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
@@ -430,24 +436,47 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") );
|
wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
size_t nItems = items.GetCount();
|
size_t nItems = items.GetCount();
|
||||||
|
int index;
|
||||||
|
|
||||||
if (pos == length)
|
if (m_strings)
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < nItems; n++ )
|
for (size_t n = 0; n < nItems; n++)
|
||||||
{
|
{
|
||||||
GtkAddItem( items[n] );
|
index = m_strings->Add( items[n] );
|
||||||
|
|
||||||
m_clientList.Append((wxObject *)NULL);
|
if (index != GetCount())
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n], index );
|
||||||
|
wxNode *node = m_clientList.Nth( index );
|
||||||
|
m_clientList.Insert( node, (wxObject*) NULL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n] );
|
||||||
|
m_clientList.Append( (wxObject*) NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxNode *node = m_clientList.Nth( pos );
|
if (pos == length)
|
||||||
for ( size_t n = 0; n < nItems; n++ )
|
|
||||||
{
|
{
|
||||||
GtkAddItem( items[n], pos+n );
|
for ( size_t n = 0; n < nItems; n++ )
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n] );
|
||||||
|
|
||||||
m_clientList.Insert( node, (wxObject *)NULL );
|
m_clientList.Append((wxObject *)NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxNode *node = m_clientList.Nth( pos );
|
||||||
|
for ( size_t n = 0; n < nItems; n++ )
|
||||||
|
{
|
||||||
|
GtkAddItem( items[n], pos+n );
|
||||||
|
|
||||||
|
m_clientList.Insert( node, (wxObject *)NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,7 +63,8 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust, wxScrollBar *win )
|
|||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
||||||
|
|
||||||
int value = (int)ceil(adjust->value);
|
double dvalue = adjust->value;
|
||||||
|
int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5);
|
||||||
|
|
||||||
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
|
||||||
|
|
||||||
wxScrollBar::~wxScrollBar(void)
|
wxScrollBar::~wxScrollBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
!CreateBase( parent, id, pos, size, style, validator, name ))
|
!CreateBase( parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxScrollBar creation failed") );
|
wxFAIL_MSG( wxT("wxScrollBar creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_oldPos = 0.0;
|
m_oldPos = 0.0;
|
||||||
@@ -182,9 +183,10 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition(void) const
|
int wxScrollBar::GetThumbPosition() const
|
||||||
{
|
{
|
||||||
return (int)(m_adjust->value+0.5);
|
double val = m_adjust->value;
|
||||||
|
return (int)(val >= 0 ? val - 0.5 : val + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbSize() const
|
int wxScrollBar::GetThumbSize() const
|
||||||
@@ -252,7 +254,7 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Backward compatibility */
|
/* Backward compatibility */
|
||||||
int wxScrollBar::GetValue(void) const
|
int wxScrollBar::GetValue() const
|
||||||
{
|
{
|
||||||
return GetThumbPosition();
|
return GetThumbPosition();
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,8 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win )
|
|||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
|
||||||
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
|
||||||
|
|
||||||
int value = (int)ceil(adjust->value);
|
double dvalue = adjust->value;
|
||||||
|
int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5);
|
||||||
|
|
||||||
int orient = wxHORIZONTAL;
|
int orient = wxHORIZONTAL;
|
||||||
if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
|
if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
|
||||||
|
@@ -55,6 +55,24 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "changed"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win )
|
||||||
|
{
|
||||||
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
event.SetInt( win->GetValue() );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxSpinCtrl
|
// wxSpinCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -125,6 +143,9 @@ void wxSpinCtrl::GtkDisableEvents()
|
|||||||
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
|
GTK_SIGNAL_FUNC(gtk_spinctrl_text_changed_callback),
|
||||||
|
(gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinCtrl::GtkEnableEvents()
|
void wxSpinCtrl::GtkEnableEvents()
|
||||||
@@ -133,6 +154,11 @@ void wxSpinCtrl::GtkEnableEvents()
|
|||||||
"value_changed",
|
"value_changed",
|
||||||
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
GTK_SIGNAL_FUNC(gtk_spinctrl_callback),
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
|
"changed",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_spinctrl_text_changed_callback),
|
||||||
|
(gpointer)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSpinCtrl::GetMin() const
|
int wxSpinCtrl::GetMin() const
|
||||||
|
Reference in New Issue
Block a user