Second part of '[ 1216148 ] cleanup: unused variables and declarations'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -143,8 +143,6 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
|||||||
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define GC_POOL_SIZE 200
|
|
||||||
|
|
||||||
enum wxPoolGCType
|
enum wxPoolGCType
|
||||||
{
|
{
|
||||||
wxGC_ERROR = 0,
|
wxGC_ERROR = 0,
|
||||||
|
@@ -26,11 +26,9 @@
|
|||||||
#include "wx/gtk/win_gtk.h"
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// idle system
|
// global data
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
|
||||||
extern bool g_isIdle;
|
|
||||||
extern int g_openDialogs;
|
extern int g_openDialogs;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -49,9 +47,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxTopLevelWindow)
|
|||||||
void wxDialog::Init()
|
void wxDialog::Init()
|
||||||
{
|
{
|
||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = false;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = false;
|
||||||
m_themeEnabled = TRUE;
|
m_themeEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDialog::wxDialog( wxWindow *parent,
|
wxDialog::wxDialog( wxWindow *parent,
|
||||||
@@ -92,7 +90,7 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetReturnCode(wxID_CANCEL);
|
SetReturnCode(wxID_CANCEL);
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +105,7 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetReturnCode(wxID_OK);
|
SetReturnCode(wxID_OK);
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,12 +202,12 @@ int wxDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
|
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
|
||||||
|
|
||||||
Show( TRUE );
|
Show( true );
|
||||||
|
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
m_modalShowing = TRUE;
|
m_modalShowing = true;
|
||||||
|
|
||||||
g_openDialogs++;
|
g_openDialogs++;
|
||||||
|
|
||||||
@@ -232,9 +230,9 @@ void wxDialog::EndModal( int retCode )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = false;
|
||||||
|
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
|
|
||||||
Show( FALSE );
|
Show( false );
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
extern void wxapp_install_idle_handler();
|
||||||
extern bool g_isIdle;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "clicked" for OK-button
|
// "clicked" for OK-button
|
||||||
|
@@ -58,7 +58,6 @@ const int wxPLACE_HOLDER = 0;
|
|||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
extern void wxapp_install_idle_handler();
|
||||||
extern bool g_isIdle;
|
extern bool g_isIdle;
|
||||||
extern int g_openDialogs;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event tables
|
// event tables
|
||||||
@@ -85,7 +84,7 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
{
|
{
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = FALSE;
|
win->m_menuBarDetached = false;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
// Raise the client area area
|
// Raise the client area area
|
||||||
gdk_window_raise( win->m_wxwindow->window );
|
gdk_window_raise( win->m_wxwindow->window );
|
||||||
|
|
||||||
win->m_menuBarDetached = TRUE;
|
win->m_menuBarDetached = true;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +121,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
{
|
{
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = FALSE;
|
win->m_toolBarDetached = false;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,7 +141,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
// Raise the client area area
|
// Raise the client area area
|
||||||
gdk_window_raise( win->m_wxwindow->window );
|
gdk_window_raise( win->m_wxwindow->window );
|
||||||
|
|
||||||
win->m_toolBarDetached = TRUE;
|
win->m_toolBarDetached = true;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +175,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
child->m_y,
|
child->m_y,
|
||||||
child->m_width,
|
child->m_width,
|
||||||
child->m_height );
|
child->m_height );
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR_NATIVE
|
||||||
// We connect to these events for recalculating the client area
|
// We connect to these events for recalculating the client area
|
||||||
// space when the toolbar is floating
|
// space when the toolbar is floating
|
||||||
@@ -204,7 +203,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
child->m_width,
|
child->m_width,
|
||||||
child->m_height );
|
child->m_height );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize on OnInternalIdle
|
// Resize on OnInternalIdle
|
||||||
parent->GtkUpdateSize();
|
parent->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
@@ -215,8 +214,8 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
|
|
||||||
void wxFrame::Init()
|
void wxFrame::Init()
|
||||||
{
|
{
|
||||||
m_menuBarDetached = FALSE;
|
m_menuBarDetached = false;
|
||||||
m_toolBarDetached = FALSE;
|
m_toolBarDetached = false;
|
||||||
m_menuBarHeight = 2;
|
m_menuBarHeight = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,13 +230,13 @@ bool wxFrame::Create( wxWindow *parent,
|
|||||||
bool rt = wxTopLevelWindow::Create(parent, id, title, pos, sizeOrig,
|
bool rt = wxTopLevelWindow::Create(parent, id, title, pos, sizeOrig,
|
||||||
style, name);
|
style, name);
|
||||||
m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
|
m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = true;
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +351,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
|
|
||||||
// avoid recursions
|
// avoid recursions
|
||||||
if (m_resizing) return;
|
if (m_resizing) return;
|
||||||
m_resizing = TRUE;
|
m_resizing = true;
|
||||||
|
|
||||||
// this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
|
// this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
|
||||||
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
|
||||||
@@ -498,7 +497,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_sizeSet = TRUE;
|
m_sizeSet = true;
|
||||||
|
|
||||||
// send size event to frame
|
// send size event to frame
|
||||||
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
||||||
@@ -515,7 +514,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_resizing = FALSE;
|
m_resizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::OnInternalIdle()
|
void wxFrame::OnInternalIdle()
|
||||||
@@ -602,7 +601,7 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
|||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_show( m_frameMenuBar->m_widget );
|
gtk_widget_show( m_frameMenuBar->m_widget );
|
||||||
|
|
||||||
UpdateMenuBarSize();
|
UpdateMenuBarSize();
|
||||||
@@ -620,7 +619,7 @@ void wxFrame::UpdateMenuBarSize()
|
|||||||
|
|
||||||
req.width = 2;
|
req.width = 2;
|
||||||
req.height = 2;
|
req.height = 2;
|
||||||
|
|
||||||
// this is called after Remove with a NULL m_frameMenuBar
|
// this is called after Remove with a NULL m_frameMenuBar
|
||||||
if ( m_frameMenuBar )
|
if ( m_frameMenuBar )
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
|
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
|
||||||
@@ -641,11 +640,11 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||||
|
|
||||||
m_insertInClientArea = FALSE;
|
m_insertInClientArea = false;
|
||||||
|
|
||||||
m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );
|
m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );
|
||||||
|
|
||||||
m_insertInClientArea = TRUE;
|
m_insertInClientArea = true;
|
||||||
|
|
||||||
GtkUpdateSize();
|
GtkUpdateSize();
|
||||||
|
|
||||||
@@ -700,10 +699,10 @@ wxStatusBar* wxFrame::CreateStatusBar(int number,
|
|||||||
void wxFrame::SetStatusBar(wxStatusBar *statbar)
|
void wxFrame::SetStatusBar(wxStatusBar *statbar)
|
||||||
{
|
{
|
||||||
bool hadStatBar = m_frameStatusBar != NULL;
|
bool hadStatBar = m_frameStatusBar != NULL;
|
||||||
|
|
||||||
wxFrameBase::SetStatusBar(statbar);
|
wxFrameBase::SetStatusBar(statbar);
|
||||||
|
|
||||||
if (hadStatBar && !m_frameStatusBar)
|
if (hadStatBar && !m_frameStatusBar)
|
||||||
GtkUpdateSize();
|
GtkUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,6 +42,11 @@
|
|||||||
#define WXUNUSED_IN_GTK1(arg)
|
#define WXUNUSED_IN_GTK1(arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// RR: After a correction to the orientation of the sash
|
||||||
|
// this doesn't seem to be required anymore and it
|
||||||
|
// seems to confuse some themes so USE_ERASE_RECT=0
|
||||||
|
#define USE_ERASE_RECT 0
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererGTK: our wxRendererNative implementation
|
// wxRendererGTK: our wxRendererNative implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -196,7 +201,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
|
|||||||
state = GTK_STATE_PRELIGHT;
|
state = GTK_STATE_PRELIGHT;
|
||||||
else
|
else
|
||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
// VZ: I don't know how to get the size of the expander so as to centre it
|
// VZ: I don't know how to get the size of the expander so as to centre it
|
||||||
// in the given rectangle, +2/3 below is just what looks good here...
|
// in the given rectangle, +2/3 below is just what looks good here...
|
||||||
gtk_paint_expander
|
gtk_paint_expander
|
||||||
@@ -237,7 +242,7 @@ static int GetGtkSplitterFullSize()
|
|||||||
|
|
||||||
gint handle_size;
|
gint handle_size;
|
||||||
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
|
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
|
||||||
|
|
||||||
return handle_size;
|
return handle_size;
|
||||||
#else
|
#else
|
||||||
return SASH_SIZE + SASH_MARGIN;
|
return SASH_SIZE + SASH_MARGIN;
|
||||||
@@ -282,14 +287,17 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
// window not realized yet
|
// window not realized yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord full_size = GetGtkSplitterFullSize();
|
wxCoord full_size = GetGtkSplitterFullSize();
|
||||||
|
|
||||||
// are we drawing vertical or horizontal splitter?
|
// are we drawing vertical or horizontal splitter?
|
||||||
const bool isVert = orient == wxVERTICAL;
|
const bool isVert = orient == wxVERTICAL;
|
||||||
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
#if USE_ERASE_RECT
|
||||||
GdkRectangle erase_rect;
|
GdkRectangle erase_rect;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( isVert )
|
if ( isVert )
|
||||||
{
|
{
|
||||||
int h = win->GetClientSize().GetHeight();
|
int h = win->GetClientSize().GetHeight();
|
||||||
@@ -299,10 +307,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
rect.width = full_size;
|
rect.width = full_size;
|
||||||
rect.height = h;
|
rect.height = h;
|
||||||
|
|
||||||
|
#if USE_ERASE_RECT
|
||||||
erase_rect.x = position;
|
erase_rect.x = position;
|
||||||
erase_rect.y = 0;
|
erase_rect.y = 0;
|
||||||
erase_rect.width = full_size;
|
erase_rect.width = full_size;
|
||||||
erase_rect.height = h;
|
erase_rect.height = h;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else // horz
|
else // horz
|
||||||
{
|
{
|
||||||
@@ -313,17 +323,15 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
rect.height = full_size;
|
rect.height = full_size;
|
||||||
rect.width = w;
|
rect.width = w;
|
||||||
|
|
||||||
|
#if USE_ERASE_RECT
|
||||||
erase_rect.y = position;
|
erase_rect.y = position;
|
||||||
erase_rect.x = 0;
|
erase_rect.x = 0;
|
||||||
erase_rect.height = full_size;
|
erase_rect.height = full_size;
|
||||||
erase_rect.width = w;
|
erase_rect.width = w;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if USE_ERASE_RECT
|
||||||
// RR: After a correction to the orientation of the sash
|
|
||||||
// this doesn't seem to be required anymore and it
|
|
||||||
// seems to confuse some themes
|
|
||||||
|
|
||||||
// we must erase everything first, otherwise the garbage
|
// we must erase everything first, otherwise the garbage
|
||||||
// from the old sash is left when dragging it
|
// from the old sash is left when dragging it
|
||||||
gtk_paint_flat_box
|
gtk_paint_flat_box
|
||||||
|
@@ -35,7 +35,6 @@ extern bool g_isIdle;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
extern bool g_blockEventsOnScroll;
|
|
||||||
static wxEventType g_currentUpDownEvent = wxEVT_NULL;
|
static wxEventType g_currentUpDownEvent = wxEVT_NULL;
|
||||||
|
|
||||||
static const float sensitivity = 0.02;
|
static const float sensitivity = 0.02;
|
||||||
@@ -71,13 +70,13 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust,
|
|||||||
// throw a LINEUP / LINEDOWN event if necessary
|
// throw a LINEUP / LINEDOWN event if necessary
|
||||||
if (g_currentUpDownEvent != wxEVT_NULL)
|
if (g_currentUpDownEvent != wxEVT_NULL)
|
||||||
{
|
{
|
||||||
wxScrollEvent event( g_currentUpDownEvent, win->GetId(), value, orient );
|
wxScrollEvent event( g_currentUpDownEvent, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw other event (wxEVT_SCROLL_THUMBTRACK)
|
// throw other event (wxEVT_SCROLL_THUMBTRACK)
|
||||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
@@ -105,9 +104,9 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
|
|||||||
{
|
{
|
||||||
int scroll_height, mouse_pos;
|
int scroll_height, mouse_pos;
|
||||||
|
|
||||||
// get the mouse position when the click is done
|
// get the mouse position when the click is done
|
||||||
if (win->HasFlag(wxSB_VERTICAL))
|
if (win->HasFlag(wxSB_VERTICAL))
|
||||||
{
|
{
|
||||||
scroll_height = GTK_WIDGET(widget)->allocation.height - 16;
|
scroll_height = GTK_WIDGET(widget)->allocation.height - 16;
|
||||||
mouse_pos = (int)gdk_event->y;
|
mouse_pos = (int)gdk_event->y;
|
||||||
}
|
}
|
||||||
@@ -116,7 +115,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
|
|||||||
scroll_height = GTK_WIDGET(widget)->allocation.width - 16;
|
scroll_height = GTK_WIDGET(widget)->allocation.width - 16;
|
||||||
mouse_pos = (int)gdk_event->x;
|
mouse_pos = (int)gdk_event->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare mouse position to scrollbar height
|
// compare mouse position to scrollbar height
|
||||||
if (mouse_pos > scroll_height)
|
if (mouse_pos > scroll_height)
|
||||||
g_currentUpDownEvent = wxEVT_SCROLL_LINEDOWN;
|
g_currentUpDownEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
@@ -157,7 +156,7 @@ gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
win->m_isScrolling = FALSE;
|
win->m_isScrolling = false;
|
||||||
|
|
||||||
// reset the LINEUP/LINEDOWN flag when the mouse button is released
|
// reset the LINEUP/LINEDOWN flag when the mouse button is released
|
||||||
g_currentUpDownEvent = wxEVT_NULL;
|
g_currentUpDownEvent = wxEVT_NULL;
|
||||||
@@ -180,14 +179,14 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxValidator& validator, const wxString& name )
|
long style, const wxValidator& validator, const wxString& name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!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;
|
||||||
@@ -216,7 +215,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition() const
|
int wxScrollBar::GetThumbPosition() const
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
extern GdkFont *GtkGetDefaultGuiFont();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// globals
|
// globals
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -271,7 +269,7 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
|
|||||||
void wxToolBar::Init()
|
void wxToolBar::Init()
|
||||||
{
|
{
|
||||||
m_toolbar = (GtkToolbar *)NULL;
|
m_toolbar = (GtkToolbar *)NULL;
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
m_defaultWidth = 32;
|
m_defaultWidth = 32;
|
||||||
m_defaultHeight = 32;
|
m_defaultHeight = 32;
|
||||||
}
|
}
|
||||||
@@ -287,7 +285,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name )
|
const wxString& name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
||||||
|
|
||||||
if ( !PreCreation( parent, pos, size ) ||
|
if ( !PreCreation( parent, pos, size ) ||
|
||||||
@@ -295,7 +293,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxToolBar creation failed") );
|
wxFAIL_MSG( wxT("wxToolBar creation failed") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
@@ -344,7 +342,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::GtkSetStyle()
|
void wxToolBar::GtkSetStyle()
|
||||||
@@ -383,13 +381,13 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
{
|
{
|
||||||
wxBitmap bitmap = tool->GetNormalBitmap();
|
wxBitmap bitmap = tool->GetNormalBitmap();
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
wxCHECK_MSG( bitmap.Ok(), false,
|
||||||
wxT("invalid bitmap for wxToolBar icon") );
|
wxT("invalid bitmap for wxToolBar icon") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetBitmap() == NULL, false,
|
||||||
wxT("wxToolBar doesn't support GdkBitmap") );
|
wxT("wxToolBar doesn't support GdkBitmap") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetPixmap() != NULL, false,
|
||||||
wxT("wxToolBar::Add needs a wxBitmap") );
|
wxT("wxToolBar::Add needs a wxBitmap") );
|
||||||
|
|
||||||
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
||||||
@@ -410,7 +408,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
GdkBitmap *mask = (GdkBitmap *)NULL;
|
GdkBitmap *mask = (GdkBitmap *)NULL;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
mask = bitmap.GetMask()->GetBitmap();
|
mask = bitmap.GetMask()->GetBitmap();
|
||||||
|
|
||||||
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
||||||
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
||||||
}
|
}
|
||||||
@@ -452,7 +450,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
// this is the first button in the radio button group,
|
// this is the first button in the radio button group,
|
||||||
// it will be toggled automatically by GTK so bring the
|
// it will be toggled automatically by GTK so bring the
|
||||||
// internal flag in sync
|
// internal flag in sync
|
||||||
tool->Toggle(TRUE);
|
tool->Toggle(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +476,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("gtk_toolbar_insert_element() failed") );
|
wxFAIL_MSG( _T("gtk_toolbar_insert_element() failed") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
||||||
@@ -496,7 +494,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
gtk_toolbar_insert_space( m_toolbar, posGtk );
|
gtk_toolbar_insert_space( m_toolbar, posGtk );
|
||||||
|
|
||||||
// skip the rest
|
// skip the rest
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case wxTOOL_STYLE_CONTROL:
|
case wxTOOL_STYLE_CONTROL:
|
||||||
gtk_toolbar_insert_widget(
|
gtk_toolbar_insert_widget(
|
||||||
@@ -516,7 +514,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
m_height = req.height + 2*m_yMargin;
|
m_height = req.height + 2*m_yMargin;
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
||||||
@@ -541,7 +539,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -567,11 +565,11 @@ void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
|
|||||||
{
|
{
|
||||||
tool->SetPixmap(tool->GetBitmap());
|
tool->SetPixmap(tool->GetBitmap());
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,6 @@ extern bool g_isIdle;
|
|||||||
// data
|
// data
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
extern wxWindowGTK *g_delayedFocus;
|
extern wxWindowGTK *g_delayedFocus;
|
||||||
|
|
||||||
|
@@ -24,24 +24,23 @@ extern void wxapp_install_idle_handler();
|
|||||||
extern bool g_isIdle;
|
extern bool g_isIdle;
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
extern wxWindowGTK *g_delayedFocus;
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
||||||
{
|
{
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cb->m_blockEvent) return;
|
|
||||||
|
|
||||||
// Generate a wx event.
|
if (cb->m_blockEvent) return;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
|
|
||||||
event.SetInt(cb->GetValue());
|
// Generate a wx event.
|
||||||
event.SetEventObject(cb);
|
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
|
||||||
cb->GetEventHandler()->ProcessEvent(event);
|
event.SetInt(cb->GetValue());
|
||||||
|
event.SetEventObject(cb);
|
||||||
|
cb->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,18 +58,18 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString &name)
|
const wxString &name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, size) ||
|
if (!PreCreation(parent, pos, size) ||
|
||||||
!CreateBase(parent, id, pos, size, style, validator, name ))
|
!CreateBase(parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
|
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bitmap = label;
|
m_bitmap = label;
|
||||||
|
|
||||||
// Create the gtk widget.
|
// Create the gtk widget.
|
||||||
@@ -92,32 +91,32 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SetValue(bool state)
|
// void SetValue(bool state)
|
||||||
// Set the value of the toggle button.
|
// Set the value of the toggle button.
|
||||||
void wxToggleBitmapButton::SetValue(bool state)
|
void wxToggleBitmapButton::SetValue(bool state)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
if (state == GetValue())
|
if (state == GetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool GetValue() const
|
// bool GetValue() const
|
||||||
// Get the value of the toggle button.
|
// Get the value of the toggle button.
|
||||||
bool wxToggleBitmapButton::GetValue() const
|
bool wxToggleBitmapButton::GetValue() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(m_widget != NULL, FALSE, wxT("invalid toggle button"));
|
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
||||||
|
|
||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
||||||
@@ -126,7 +125,7 @@ void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
|||||||
|
|
||||||
m_bitmap = label;
|
m_bitmap = label;
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
OnSetBitmap();
|
OnSetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,14 +151,14 @@ void wxToggleBitmapButton::OnSetBitmap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleBitmapButton::Enable(bool enable /*=TRUE*/)
|
bool wxToggleBitmapButton::Enable(bool enable /*=true*/)
|
||||||
{
|
{
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||||
@@ -176,7 +175,7 @@ bool wxToggleBitmapButton::IsOwnGtkWindow(GdkWindow *window)
|
|||||||
void wxToggleBitmapButton::OnInternalIdle()
|
void wxToggleBitmapButton::OnInternalIdle()
|
||||||
{
|
{
|
||||||
wxCursor cursor = m_cursor;
|
wxCursor cursor = m_cursor;
|
||||||
|
|
||||||
if (g_globalCursor.Ok())
|
if (g_globalCursor.Ok())
|
||||||
cursor = g_globalCursor;
|
cursor = g_globalCursor;
|
||||||
|
|
||||||
@@ -200,7 +199,7 @@ void wxToggleBitmapButton::OnInternalIdle()
|
|||||||
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize best;
|
wxSize best;
|
||||||
|
|
||||||
if (m_bitmap.Ok())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
|
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
|
||||||
@@ -232,56 +231,56 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString &name)
|
const wxString &name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, size) ||
|
m_blockEvent = false;
|
||||||
!CreateBase(parent, id, pos, size, style, validator, name )) {
|
|
||||||
wxFAIL_MSG(wxT("wxToggleButton creation failed"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxControl::SetLabel(label);
|
if (!PreCreation(parent, pos, size) ||
|
||||||
|
!CreateBase(parent, id, pos, size, style, validator, name )) {
|
||||||
|
wxFAIL_MSG(wxT("wxToggleButton creation failed"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the gtk widget.
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
|
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
|
// Create the gtk widget.
|
||||||
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
|
m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
|
||||||
(gpointer *)this);
|
|
||||||
|
|
||||||
m_parent->DoAddChild(this);
|
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
|
||||||
|
(gpointer *)this);
|
||||||
|
|
||||||
PostCreation(size);
|
m_parent->DoAddChild(this);
|
||||||
|
|
||||||
return TRUE;
|
PostCreation(size);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SetValue(bool state)
|
// void SetValue(bool state)
|
||||||
// Set the value of the toggle button.
|
// Set the value of the toggle button.
|
||||||
void wxToggleButton::SetValue(bool state)
|
void wxToggleButton::SetValue(bool state)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
if (state == GetValue())
|
if (state == GetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool GetValue() const
|
// bool GetValue() const
|
||||||
// Get the value of the toggle button.
|
// Get the value of the toggle button.
|
||||||
bool wxToggleButton::GetValue() const
|
bool wxToggleButton::GetValue() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(m_widget != NULL, FALSE, wxT("invalid toggle button"));
|
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
||||||
|
|
||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleButton::SetLabel(const wxString& label)
|
void wxToggleButton::SetLabel(const wxString& label)
|
||||||
@@ -293,14 +292,14 @@ void wxToggleButton::SetLabel(const wxString& label)
|
|||||||
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
|
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleButton::Enable(bool enable /*=TRUE*/)
|
bool wxToggleButton::Enable(bool enable /*=true*/)
|
||||||
{
|
{
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||||
@@ -317,7 +316,7 @@ bool wxToggleButton::IsOwnGtkWindow(GdkWindow *window)
|
|||||||
void wxToggleButton::OnInternalIdle()
|
void wxToggleButton::OnInternalIdle()
|
||||||
{
|
{
|
||||||
wxCursor cursor = m_cursor;
|
wxCursor cursor = m_cursor;
|
||||||
|
|
||||||
if (g_globalCursor.Ok())
|
if (g_globalCursor.Ok())
|
||||||
cursor = g_globalCursor;
|
cursor = g_globalCursor;
|
||||||
|
|
||||||
@@ -341,12 +340,12 @@ void wxToggleButton::OnInternalIdle()
|
|||||||
wxSize wxToggleButton::DoGetBestSize() const
|
wxSize wxToggleButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize ret(wxControl::DoGetBestSize());
|
wxSize ret(wxControl::DoGetBestSize());
|
||||||
|
|
||||||
if (!HasFlag(wxBU_EXACTFIT))
|
if (!HasFlag(wxBU_EXACTFIT))
|
||||||
{
|
{
|
||||||
if (ret.x < 80) ret.x = 80;
|
if (ret.x < 80) ret.x = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheBestSize(ret);
|
CacheBestSize(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -143,8 +143,6 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
|||||||
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
// Implement Pool of Graphic contexts. Creating them takes too much time.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define GC_POOL_SIZE 200
|
|
||||||
|
|
||||||
enum wxPoolGCType
|
enum wxPoolGCType
|
||||||
{
|
{
|
||||||
wxGC_ERROR = 0,
|
wxGC_ERROR = 0,
|
||||||
|
@@ -26,11 +26,9 @@
|
|||||||
#include "wx/gtk/win_gtk.h"
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// idle system
|
// global data
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
|
||||||
extern bool g_isIdle;
|
|
||||||
extern int g_openDialogs;
|
extern int g_openDialogs;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -49,9 +47,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxTopLevelWindow)
|
|||||||
void wxDialog::Init()
|
void wxDialog::Init()
|
||||||
{
|
{
|
||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = false;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = false;
|
||||||
m_themeEnabled = TRUE;
|
m_themeEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDialog::wxDialog( wxWindow *parent,
|
wxDialog::wxDialog( wxWindow *parent,
|
||||||
@@ -92,7 +90,7 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetReturnCode(wxID_CANCEL);
|
SetReturnCode(wxID_CANCEL);
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +105,7 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetReturnCode(wxID_OK);
|
SetReturnCode(wxID_OK);
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,12 +202,12 @@ int wxDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
|
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
|
||||||
|
|
||||||
Show( TRUE );
|
Show( true );
|
||||||
|
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
m_modalShowing = TRUE;
|
m_modalShowing = true;
|
||||||
|
|
||||||
g_openDialogs++;
|
g_openDialogs++;
|
||||||
|
|
||||||
@@ -232,9 +230,9 @@ void wxDialog::EndModal( int retCode )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = false;
|
||||||
|
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
|
|
||||||
Show( FALSE );
|
Show( false );
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
extern void wxapp_install_idle_handler();
|
||||||
extern bool g_isIdle;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "clicked" for OK-button
|
// "clicked" for OK-button
|
||||||
|
@@ -58,7 +58,6 @@ const int wxPLACE_HOLDER = 0;
|
|||||||
|
|
||||||
extern void wxapp_install_idle_handler();
|
extern void wxapp_install_idle_handler();
|
||||||
extern bool g_isIdle;
|
extern bool g_isIdle;
|
||||||
extern int g_openDialogs;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event tables
|
// event tables
|
||||||
@@ -85,7 +84,7 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
{
|
{
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = FALSE;
|
win->m_menuBarDetached = false;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
// Raise the client area area
|
// Raise the client area area
|
||||||
gdk_window_raise( win->m_wxwindow->window );
|
gdk_window_raise( win->m_wxwindow->window );
|
||||||
|
|
||||||
win->m_menuBarDetached = TRUE;
|
win->m_menuBarDetached = true;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +121,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
{
|
{
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = FALSE;
|
win->m_toolBarDetached = false;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,7 +141,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
// Raise the client area area
|
// Raise the client area area
|
||||||
gdk_window_raise( win->m_wxwindow->window );
|
gdk_window_raise( win->m_wxwindow->window );
|
||||||
|
|
||||||
win->m_toolBarDetached = TRUE;
|
win->m_toolBarDetached = true;
|
||||||
win->GtkUpdateSize();
|
win->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +175,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
child->m_y,
|
child->m_y,
|
||||||
child->m_width,
|
child->m_width,
|
||||||
child->m_height );
|
child->m_height );
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR_NATIVE
|
||||||
// We connect to these events for recalculating the client area
|
// We connect to these events for recalculating the client area
|
||||||
// space when the toolbar is floating
|
// space when the toolbar is floating
|
||||||
@@ -204,7 +203,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
child->m_width,
|
child->m_width,
|
||||||
child->m_height );
|
child->m_height );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize on OnInternalIdle
|
// Resize on OnInternalIdle
|
||||||
parent->GtkUpdateSize();
|
parent->GtkUpdateSize();
|
||||||
}
|
}
|
||||||
@@ -215,8 +214,8 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
|
|||||||
|
|
||||||
void wxFrame::Init()
|
void wxFrame::Init()
|
||||||
{
|
{
|
||||||
m_menuBarDetached = FALSE;
|
m_menuBarDetached = false;
|
||||||
m_toolBarDetached = FALSE;
|
m_toolBarDetached = false;
|
||||||
m_menuBarHeight = 2;
|
m_menuBarHeight = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,13 +230,13 @@ bool wxFrame::Create( wxWindow *parent,
|
|||||||
bool rt = wxTopLevelWindow::Create(parent, id, title, pos, sizeOrig,
|
bool rt = wxTopLevelWindow::Create(parent, id, title, pos, sizeOrig,
|
||||||
style, name);
|
style, name);
|
||||||
m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
|
m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = true;
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +351,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
|
|
||||||
// avoid recursions
|
// avoid recursions
|
||||||
if (m_resizing) return;
|
if (m_resizing) return;
|
||||||
m_resizing = TRUE;
|
m_resizing = true;
|
||||||
|
|
||||||
// this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
|
// this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
|
||||||
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
|
||||||
@@ -498,7 +497,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_sizeSet = TRUE;
|
m_sizeSet = true;
|
||||||
|
|
||||||
// send size event to frame
|
// send size event to frame
|
||||||
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
||||||
@@ -515,7 +514,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_resizing = FALSE;
|
m_resizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::OnInternalIdle()
|
void wxFrame::OnInternalIdle()
|
||||||
@@ -602,7 +601,7 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
|||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_show( m_frameMenuBar->m_widget );
|
gtk_widget_show( m_frameMenuBar->m_widget );
|
||||||
|
|
||||||
UpdateMenuBarSize();
|
UpdateMenuBarSize();
|
||||||
@@ -620,7 +619,7 @@ void wxFrame::UpdateMenuBarSize()
|
|||||||
|
|
||||||
req.width = 2;
|
req.width = 2;
|
||||||
req.height = 2;
|
req.height = 2;
|
||||||
|
|
||||||
// this is called after Remove with a NULL m_frameMenuBar
|
// this is called after Remove with a NULL m_frameMenuBar
|
||||||
if ( m_frameMenuBar )
|
if ( m_frameMenuBar )
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
|
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
|
||||||
@@ -641,11 +640,11 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||||
|
|
||||||
m_insertInClientArea = FALSE;
|
m_insertInClientArea = false;
|
||||||
|
|
||||||
m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );
|
m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );
|
||||||
|
|
||||||
m_insertInClientArea = TRUE;
|
m_insertInClientArea = true;
|
||||||
|
|
||||||
GtkUpdateSize();
|
GtkUpdateSize();
|
||||||
|
|
||||||
@@ -700,10 +699,10 @@ wxStatusBar* wxFrame::CreateStatusBar(int number,
|
|||||||
void wxFrame::SetStatusBar(wxStatusBar *statbar)
|
void wxFrame::SetStatusBar(wxStatusBar *statbar)
|
||||||
{
|
{
|
||||||
bool hadStatBar = m_frameStatusBar != NULL;
|
bool hadStatBar = m_frameStatusBar != NULL;
|
||||||
|
|
||||||
wxFrameBase::SetStatusBar(statbar);
|
wxFrameBase::SetStatusBar(statbar);
|
||||||
|
|
||||||
if (hadStatBar && !m_frameStatusBar)
|
if (hadStatBar && !m_frameStatusBar)
|
||||||
GtkUpdateSize();
|
GtkUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,6 +42,11 @@
|
|||||||
#define WXUNUSED_IN_GTK1(arg)
|
#define WXUNUSED_IN_GTK1(arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// RR: After a correction to the orientation of the sash
|
||||||
|
// this doesn't seem to be required anymore and it
|
||||||
|
// seems to confuse some themes so USE_ERASE_RECT=0
|
||||||
|
#define USE_ERASE_RECT 0
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererGTK: our wxRendererNative implementation
|
// wxRendererGTK: our wxRendererNative implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -196,7 +201,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
|
|||||||
state = GTK_STATE_PRELIGHT;
|
state = GTK_STATE_PRELIGHT;
|
||||||
else
|
else
|
||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
// VZ: I don't know how to get the size of the expander so as to centre it
|
// VZ: I don't know how to get the size of the expander so as to centre it
|
||||||
// in the given rectangle, +2/3 below is just what looks good here...
|
// in the given rectangle, +2/3 below is just what looks good here...
|
||||||
gtk_paint_expander
|
gtk_paint_expander
|
||||||
@@ -237,7 +242,7 @@ static int GetGtkSplitterFullSize()
|
|||||||
|
|
||||||
gint handle_size;
|
gint handle_size;
|
||||||
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
|
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
|
||||||
|
|
||||||
return handle_size;
|
return handle_size;
|
||||||
#else
|
#else
|
||||||
return SASH_SIZE + SASH_MARGIN;
|
return SASH_SIZE + SASH_MARGIN;
|
||||||
@@ -282,14 +287,17 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
// window not realized yet
|
// window not realized yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord full_size = GetGtkSplitterFullSize();
|
wxCoord full_size = GetGtkSplitterFullSize();
|
||||||
|
|
||||||
// are we drawing vertical or horizontal splitter?
|
// are we drawing vertical or horizontal splitter?
|
||||||
const bool isVert = orient == wxVERTICAL;
|
const bool isVert = orient == wxVERTICAL;
|
||||||
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
#if USE_ERASE_RECT
|
||||||
GdkRectangle erase_rect;
|
GdkRectangle erase_rect;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( isVert )
|
if ( isVert )
|
||||||
{
|
{
|
||||||
int h = win->GetClientSize().GetHeight();
|
int h = win->GetClientSize().GetHeight();
|
||||||
@@ -299,10 +307,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
rect.width = full_size;
|
rect.width = full_size;
|
||||||
rect.height = h;
|
rect.height = h;
|
||||||
|
|
||||||
|
#if USE_ERASE_RECT
|
||||||
erase_rect.x = position;
|
erase_rect.x = position;
|
||||||
erase_rect.y = 0;
|
erase_rect.y = 0;
|
||||||
erase_rect.width = full_size;
|
erase_rect.width = full_size;
|
||||||
erase_rect.height = h;
|
erase_rect.height = h;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else // horz
|
else // horz
|
||||||
{
|
{
|
||||||
@@ -313,17 +323,15 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
rect.height = full_size;
|
rect.height = full_size;
|
||||||
rect.width = w;
|
rect.width = w;
|
||||||
|
|
||||||
|
#if USE_ERASE_RECT
|
||||||
erase_rect.y = position;
|
erase_rect.y = position;
|
||||||
erase_rect.x = 0;
|
erase_rect.x = 0;
|
||||||
erase_rect.height = full_size;
|
erase_rect.height = full_size;
|
||||||
erase_rect.width = w;
|
erase_rect.width = w;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if USE_ERASE_RECT
|
||||||
// RR: After a correction to the orientation of the sash
|
|
||||||
// this doesn't seem to be required anymore and it
|
|
||||||
// seems to confuse some themes
|
|
||||||
|
|
||||||
// we must erase everything first, otherwise the garbage
|
// we must erase everything first, otherwise the garbage
|
||||||
// from the old sash is left when dragging it
|
// from the old sash is left when dragging it
|
||||||
gtk_paint_flat_box
|
gtk_paint_flat_box
|
||||||
|
@@ -35,7 +35,6 @@ extern bool g_isIdle;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
extern bool g_blockEventsOnScroll;
|
|
||||||
static wxEventType g_currentUpDownEvent = wxEVT_NULL;
|
static wxEventType g_currentUpDownEvent = wxEVT_NULL;
|
||||||
|
|
||||||
static const float sensitivity = 0.02;
|
static const float sensitivity = 0.02;
|
||||||
@@ -71,13 +70,13 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust,
|
|||||||
// throw a LINEUP / LINEDOWN event if necessary
|
// throw a LINEUP / LINEDOWN event if necessary
|
||||||
if (g_currentUpDownEvent != wxEVT_NULL)
|
if (g_currentUpDownEvent != wxEVT_NULL)
|
||||||
{
|
{
|
||||||
wxScrollEvent event( g_currentUpDownEvent, win->GetId(), value, orient );
|
wxScrollEvent event( g_currentUpDownEvent, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw other event (wxEVT_SCROLL_THUMBTRACK)
|
// throw other event (wxEVT_SCROLL_THUMBTRACK)
|
||||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
@@ -105,9 +104,9 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
|
|||||||
{
|
{
|
||||||
int scroll_height, mouse_pos;
|
int scroll_height, mouse_pos;
|
||||||
|
|
||||||
// get the mouse position when the click is done
|
// get the mouse position when the click is done
|
||||||
if (win->HasFlag(wxSB_VERTICAL))
|
if (win->HasFlag(wxSB_VERTICAL))
|
||||||
{
|
{
|
||||||
scroll_height = GTK_WIDGET(widget)->allocation.height - 16;
|
scroll_height = GTK_WIDGET(widget)->allocation.height - 16;
|
||||||
mouse_pos = (int)gdk_event->y;
|
mouse_pos = (int)gdk_event->y;
|
||||||
}
|
}
|
||||||
@@ -116,7 +115,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
|
|||||||
scroll_height = GTK_WIDGET(widget)->allocation.width - 16;
|
scroll_height = GTK_WIDGET(widget)->allocation.width - 16;
|
||||||
mouse_pos = (int)gdk_event->x;
|
mouse_pos = (int)gdk_event->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare mouse position to scrollbar height
|
// compare mouse position to scrollbar height
|
||||||
if (mouse_pos > scroll_height)
|
if (mouse_pos > scroll_height)
|
||||||
g_currentUpDownEvent = wxEVT_SCROLL_LINEDOWN;
|
g_currentUpDownEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
@@ -157,7 +156,7 @@ gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
win->m_isScrolling = FALSE;
|
win->m_isScrolling = false;
|
||||||
|
|
||||||
// reset the LINEUP/LINEDOWN flag when the mouse button is released
|
// reset the LINEUP/LINEDOWN flag when the mouse button is released
|
||||||
g_currentUpDownEvent = wxEVT_NULL;
|
g_currentUpDownEvent = wxEVT_NULL;
|
||||||
@@ -180,14 +179,14 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxValidator& validator, const wxString& name )
|
long style, const wxValidator& validator, const wxString& name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!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;
|
||||||
@@ -216,7 +215,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition() const
|
int wxScrollBar::GetThumbPosition() const
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
extern GdkFont *GtkGetDefaultGuiFont();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// globals
|
// globals
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -271,7 +269,7 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
|
|||||||
void wxToolBar::Init()
|
void wxToolBar::Init()
|
||||||
{
|
{
|
||||||
m_toolbar = (GtkToolbar *)NULL;
|
m_toolbar = (GtkToolbar *)NULL;
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
m_defaultWidth = 32;
|
m_defaultWidth = 32;
|
||||||
m_defaultHeight = 32;
|
m_defaultHeight = 32;
|
||||||
}
|
}
|
||||||
@@ -287,7 +285,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name )
|
const wxString& name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
||||||
|
|
||||||
if ( !PreCreation( parent, pos, size ) ||
|
if ( !PreCreation( parent, pos, size ) ||
|
||||||
@@ -295,7 +293,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxToolBar creation failed") );
|
wxFAIL_MSG( wxT("wxToolBar creation failed") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
@@ -344,7 +342,7 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::GtkSetStyle()
|
void wxToolBar::GtkSetStyle()
|
||||||
@@ -383,13 +381,13 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
{
|
{
|
||||||
wxBitmap bitmap = tool->GetNormalBitmap();
|
wxBitmap bitmap = tool->GetNormalBitmap();
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
wxCHECK_MSG( bitmap.Ok(), false,
|
||||||
wxT("invalid bitmap for wxToolBar icon") );
|
wxT("invalid bitmap for wxToolBar icon") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetBitmap() == NULL, false,
|
||||||
wxT("wxToolBar doesn't support GdkBitmap") );
|
wxT("wxToolBar doesn't support GdkBitmap") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetPixmap() != NULL, false,
|
||||||
wxT("wxToolBar::Add needs a wxBitmap") );
|
wxT("wxToolBar::Add needs a wxBitmap") );
|
||||||
|
|
||||||
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
||||||
@@ -410,7 +408,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
GdkBitmap *mask = (GdkBitmap *)NULL;
|
GdkBitmap *mask = (GdkBitmap *)NULL;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
mask = bitmap.GetMask()->GetBitmap();
|
mask = bitmap.GetMask()->GetBitmap();
|
||||||
|
|
||||||
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
||||||
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
||||||
}
|
}
|
||||||
@@ -452,7 +450,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
// this is the first button in the radio button group,
|
// this is the first button in the radio button group,
|
||||||
// it will be toggled automatically by GTK so bring the
|
// it will be toggled automatically by GTK so bring the
|
||||||
// internal flag in sync
|
// internal flag in sync
|
||||||
tool->Toggle(TRUE);
|
tool->Toggle(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +476,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("gtk_toolbar_insert_element() failed") );
|
wxFAIL_MSG( _T("gtk_toolbar_insert_element() failed") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
||||||
@@ -496,7 +494,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
gtk_toolbar_insert_space( m_toolbar, posGtk );
|
gtk_toolbar_insert_space( m_toolbar, posGtk );
|
||||||
|
|
||||||
// skip the rest
|
// skip the rest
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case wxTOOL_STYLE_CONTROL:
|
case wxTOOL_STYLE_CONTROL:
|
||||||
gtk_toolbar_insert_widget(
|
gtk_toolbar_insert_widget(
|
||||||
@@ -516,7 +514,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
m_height = req.height + 2*m_yMargin;
|
m_height = req.height + 2*m_yMargin;
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
||||||
@@ -541,7 +539,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -567,11 +565,11 @@ void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
|
|||||||
{
|
{
|
||||||
tool->SetPixmap(tool->GetBitmap());
|
tool->SetPixmap(tool->GetBitmap());
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,6 @@ extern bool g_isIdle;
|
|||||||
// data
|
// data
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
extern wxWindowGTK *g_delayedFocus;
|
extern wxWindowGTK *g_delayedFocus;
|
||||||
|
|
||||||
|
@@ -24,24 +24,23 @@ extern void wxapp_install_idle_handler();
|
|||||||
extern bool g_isIdle;
|
extern bool g_isIdle;
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
extern wxWindowGTK *g_delayedFocus;
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
||||||
{
|
{
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cb->m_blockEvent) return;
|
|
||||||
|
|
||||||
// Generate a wx event.
|
if (cb->m_blockEvent) return;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
|
|
||||||
event.SetInt(cb->GetValue());
|
// Generate a wx event.
|
||||||
event.SetEventObject(cb);
|
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, cb->GetId());
|
||||||
cb->GetEventHandler()->ProcessEvent(event);
|
event.SetInt(cb->GetValue());
|
||||||
|
event.SetEventObject(cb);
|
||||||
|
cb->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,18 +58,18 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString &name)
|
const wxString &name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, size) ||
|
if (!PreCreation(parent, pos, size) ||
|
||||||
!CreateBase(parent, id, pos, size, style, validator, name ))
|
!CreateBase(parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
|
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bitmap = label;
|
m_bitmap = label;
|
||||||
|
|
||||||
// Create the gtk widget.
|
// Create the gtk widget.
|
||||||
@@ -92,32 +91,32 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SetValue(bool state)
|
// void SetValue(bool state)
|
||||||
// Set the value of the toggle button.
|
// Set the value of the toggle button.
|
||||||
void wxToggleBitmapButton::SetValue(bool state)
|
void wxToggleBitmapButton::SetValue(bool state)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
if (state == GetValue())
|
if (state == GetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool GetValue() const
|
// bool GetValue() const
|
||||||
// Get the value of the toggle button.
|
// Get the value of the toggle button.
|
||||||
bool wxToggleBitmapButton::GetValue() const
|
bool wxToggleBitmapButton::GetValue() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(m_widget != NULL, FALSE, wxT("invalid toggle button"));
|
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
||||||
|
|
||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
||||||
@@ -126,7 +125,7 @@ void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
|||||||
|
|
||||||
m_bitmap = label;
|
m_bitmap = label;
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
OnSetBitmap();
|
OnSetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,14 +151,14 @@ void wxToggleBitmapButton::OnSetBitmap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleBitmapButton::Enable(bool enable /*=TRUE*/)
|
bool wxToggleBitmapButton::Enable(bool enable /*=true*/)
|
||||||
{
|
{
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||||
@@ -176,7 +175,7 @@ bool wxToggleBitmapButton::IsOwnGtkWindow(GdkWindow *window)
|
|||||||
void wxToggleBitmapButton::OnInternalIdle()
|
void wxToggleBitmapButton::OnInternalIdle()
|
||||||
{
|
{
|
||||||
wxCursor cursor = m_cursor;
|
wxCursor cursor = m_cursor;
|
||||||
|
|
||||||
if (g_globalCursor.Ok())
|
if (g_globalCursor.Ok())
|
||||||
cursor = g_globalCursor;
|
cursor = g_globalCursor;
|
||||||
|
|
||||||
@@ -200,7 +199,7 @@ void wxToggleBitmapButton::OnInternalIdle()
|
|||||||
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize best;
|
wxSize best;
|
||||||
|
|
||||||
if (m_bitmap.Ok())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
|
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
|
||||||
@@ -232,56 +231,56 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString &name)
|
const wxString &name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = true;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = true;
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, size) ||
|
m_blockEvent = false;
|
||||||
!CreateBase(parent, id, pos, size, style, validator, name )) {
|
|
||||||
wxFAIL_MSG(wxT("wxToggleButton creation failed"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxControl::SetLabel(label);
|
if (!PreCreation(parent, pos, size) ||
|
||||||
|
!CreateBase(parent, id, pos, size, style, validator, name )) {
|
||||||
|
wxFAIL_MSG(wxT("wxToggleButton creation failed"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the gtk widget.
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
|
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
|
// Create the gtk widget.
|
||||||
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
|
m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
|
||||||
(gpointer *)this);
|
|
||||||
|
|
||||||
m_parent->DoAddChild(this);
|
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
|
||||||
|
(gpointer *)this);
|
||||||
|
|
||||||
PostCreation(size);
|
m_parent->DoAddChild(this);
|
||||||
|
|
||||||
return TRUE;
|
PostCreation(size);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SetValue(bool state)
|
// void SetValue(bool state)
|
||||||
// Set the value of the toggle button.
|
// Set the value of the toggle button.
|
||||||
void wxToggleButton::SetValue(bool state)
|
void wxToggleButton::SetValue(bool state)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
if (state == GetValue())
|
if (state == GetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_blockEvent = TRUE;
|
m_blockEvent = true;
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
|
||||||
|
|
||||||
m_blockEvent = FALSE;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool GetValue() const
|
// bool GetValue() const
|
||||||
// Get the value of the toggle button.
|
// Get the value of the toggle button.
|
||||||
bool wxToggleButton::GetValue() const
|
bool wxToggleButton::GetValue() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(m_widget != NULL, FALSE, wxT("invalid toggle button"));
|
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
||||||
|
|
||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleButton::SetLabel(const wxString& label)
|
void wxToggleButton::SetLabel(const wxString& label)
|
||||||
@@ -293,14 +292,14 @@ void wxToggleButton::SetLabel(const wxString& label)
|
|||||||
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
|
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleButton::Enable(bool enable /*=TRUE*/)
|
bool wxToggleButton::Enable(bool enable /*=true*/)
|
||||||
{
|
{
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||||
@@ -317,7 +316,7 @@ bool wxToggleButton::IsOwnGtkWindow(GdkWindow *window)
|
|||||||
void wxToggleButton::OnInternalIdle()
|
void wxToggleButton::OnInternalIdle()
|
||||||
{
|
{
|
||||||
wxCursor cursor = m_cursor;
|
wxCursor cursor = m_cursor;
|
||||||
|
|
||||||
if (g_globalCursor.Ok())
|
if (g_globalCursor.Ok())
|
||||||
cursor = g_globalCursor;
|
cursor = g_globalCursor;
|
||||||
|
|
||||||
@@ -341,12 +340,12 @@ void wxToggleButton::OnInternalIdle()
|
|||||||
wxSize wxToggleButton::DoGetBestSize() const
|
wxSize wxToggleButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize ret(wxControl::DoGetBestSize());
|
wxSize ret(wxControl::DoGetBestSize());
|
||||||
|
|
||||||
if (!HasFlag(wxBU_EXACTFIT))
|
if (!HasFlag(wxBU_EXACTFIT))
|
||||||
{
|
{
|
||||||
if (ret.x < 80) ret.x = 80;
|
if (ret.x < 80) ret.x = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheBestSize(ret);
|
CacheBestSize(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user