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