Applied Russel's changes to wxToolBarBase
fixed stippled brush for bitmaps (as opposed to pixmaps) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
#include "wx/tbarbase.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// classes
|
// classes
|
||||||
@@ -38,42 +39,6 @@ class wxToolBar;
|
|||||||
|
|
||||||
extern const char *wxToolBarNameStr;
|
extern const char *wxToolBarNameStr;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxToolBarTool
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxToolBarTool: public wxObject
|
|
||||||
{
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxToolBarTool)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxToolBarTool(void) {};
|
|
||||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
|
||||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
|
||||||
bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
|
|
||||||
const wxString& shortHelpString = "", const wxString& longHelpString = "",
|
|
||||||
GtkWidget *item = (GtkWidget *) NULL );
|
|
||||||
~wxToolBarTool(void);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
int m_toolStyle;
|
|
||||||
wxObject *m_clientData;
|
|
||||||
int m_index;
|
|
||||||
bool m_toggleState;
|
|
||||||
bool m_isToggle;
|
|
||||||
bool m_deleteSecondBitmap;
|
|
||||||
bool m_enabled;
|
|
||||||
wxBitmap m_bitmap1;
|
|
||||||
wxBitmap m_bitmap2;
|
|
||||||
bool m_isMenuCommand;
|
|
||||||
wxString m_shortHelpString;
|
|
||||||
wxString m_longHelpString;
|
|
||||||
wxToolBar *m_owner;
|
|
||||||
GtkWidget *m_item;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
#include "wx/tbarbase.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// classes
|
// classes
|
||||||
@@ -38,42 +39,6 @@ class wxToolBar;
|
|||||||
|
|
||||||
extern const char *wxToolBarNameStr;
|
extern const char *wxToolBarNameStr;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxToolBarTool
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxToolBarTool: public wxObject
|
|
||||||
{
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxToolBarTool)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxToolBarTool(void) {};
|
|
||||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
|
||||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
|
||||||
bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
|
|
||||||
const wxString& shortHelpString = "", const wxString& longHelpString = "",
|
|
||||||
GtkWidget *item = (GtkWidget *) NULL );
|
|
||||||
~wxToolBarTool(void);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
int m_toolStyle;
|
|
||||||
wxObject *m_clientData;
|
|
||||||
int m_index;
|
|
||||||
bool m_toggleState;
|
|
||||||
bool m_isToggle;
|
|
||||||
bool m_deleteSecondBitmap;
|
|
||||||
bool m_enabled;
|
|
||||||
wxBitmap m_bitmap1;
|
|
||||||
wxBitmap m_bitmap2;
|
|
||||||
bool m_isMenuCommand;
|
|
||||||
wxString m_shortHelpString;
|
|
||||||
wxString m_longHelpString;
|
|
||||||
wxToolBar *m_owner;
|
|
||||||
GtkWidget *m_item;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -30,13 +30,26 @@ WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
|||||||
#define wxTOOL_STYLE_BUTTON 1
|
#define wxTOOL_STYLE_BUTTON 1
|
||||||
#define wxTOOL_STYLE_SEPARATOR 2
|
#define wxTOOL_STYLE_SEPARATOR 2
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
class WXDLLEXPORT wxToolBar;
|
||||||
|
#endif
|
||||||
|
|
||||||
class WXDLLEXPORT wxToolBarTool: public wxObject
|
class WXDLLEXPORT wxToolBarTool: public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxToolBarTool)
|
DECLARE_DYNAMIC_CLASS(wxToolBarTool)
|
||||||
public:
|
public:
|
||||||
|
wxToolBarTool() {}
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxToolBarTool(wxToolBar *owner,
|
||||||
|
int theIndex = 0, const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||||
|
bool toggle = FALSE, wxObject *clientData = (wxObject *) NULL,
|
||||||
|
const wxString& shortHelpString = "", const wxString& longHelpString = "",
|
||||||
|
GtkWidget *item = (GtkWidget *) NULL );
|
||||||
|
#else
|
||||||
wxToolBarTool(int theIndex = 0, const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
wxToolBarTool(int theIndex = 0, const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||||
bool toggle = FALSE, long xPos = -1, long yPos = -1,
|
bool toggle = FALSE, long xPos = -1, long yPos = -1,
|
||||||
const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString);
|
const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString);
|
||||||
|
#endif
|
||||||
~wxToolBarTool ();
|
~wxToolBarTool ();
|
||||||
inline void SetSize( long w, long h ) { m_width = w; m_height = h; }
|
inline void SetSize( long w, long h ) { m_width = w; m_height = h; }
|
||||||
inline long GetWidth () const { return m_width; }
|
inline long GetWidth () const { return m_width; }
|
||||||
@@ -59,6 +72,10 @@ public:
|
|||||||
bool m_isMenuCommand;
|
bool m_isMenuCommand;
|
||||||
wxString m_shortHelpString;
|
wxString m_shortHelpString;
|
||||||
wxString m_longHelpString;
|
wxString m_longHelpString;
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxToolBar *m_owner;
|
||||||
|
GtkWidget *m_item;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxToolBarBase : public wxControl
|
class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||||
|
@@ -67,7 +67,6 @@
|
|||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// GUI control options (always enabled in wxGTK)
|
// GUI control options (always enabled in wxGTK)
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use gauge item
|
* Use gauge item
|
||||||
*/
|
*/
|
||||||
@@ -84,6 +83,10 @@
|
|||||||
* Use scrollbar item
|
* Use scrollbar item
|
||||||
*/
|
*/
|
||||||
#define wxUSE_RADIOBUTTON 1
|
#define wxUSE_RADIOBUTTON 1
|
||||||
|
/*
|
||||||
|
* Use toolbar item
|
||||||
|
*/
|
||||||
|
#define wxUSE_TOOLBAR 1
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// non-GUI options
|
// non-GUI options
|
||||||
|
@@ -48,20 +48,36 @@ END_EVENT_TABLE()
|
|||||||
// is still valid: a tool may have quit the toolbar.
|
// is still valid: a tool may have quit the toolbar.
|
||||||
static wxList gs_ToolBars;
|
static wxList gs_ToolBars;
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxToolBarTool::wxToolBarTool(wxToolBar *owner, int theIndex,
|
||||||
|
const wxBitmap& theBitmap1, const wxBitmap& theBitmap2,
|
||||||
|
bool toggle, wxObject *clientData,
|
||||||
|
const wxString& helpS1, const wxString& helpS2,
|
||||||
|
GtkWidget *item )
|
||||||
|
#else
|
||||||
wxToolBarTool::wxToolBarTool(int theIndex,
|
wxToolBarTool::wxToolBarTool(int theIndex,
|
||||||
const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle,
|
const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle,
|
||||||
long xPos, long yPos, const wxString& helpS1, const wxString& helpS2)
|
long xPos, long yPos, const wxString& helpS1, const wxString& helpS2)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_toolStyle = wxTOOL_STYLE_BUTTON;
|
m_toolStyle = wxTOOL_STYLE_BUTTON;
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
m_owner = owner;
|
||||||
|
m_item = item;
|
||||||
|
m_clientData = clientData;
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
|
#else
|
||||||
m_clientData = NULL;
|
m_clientData = NULL;
|
||||||
|
m_x = xPos;
|
||||||
|
m_y = yPos;
|
||||||
|
#endif
|
||||||
m_index = theIndex;
|
m_index = theIndex;
|
||||||
m_isToggle = toggle;
|
m_isToggle = toggle;
|
||||||
m_toggleState = FALSE;
|
m_toggleState = FALSE;
|
||||||
m_enabled = TRUE;
|
m_enabled = TRUE;
|
||||||
m_bitmap1 = theBitmap1;
|
m_bitmap1 = theBitmap1;
|
||||||
m_bitmap2 = theBitmap2;
|
m_bitmap2 = theBitmap2;
|
||||||
m_x = xPos;
|
|
||||||
m_y = yPos;
|
|
||||||
m_width = m_height = 0;
|
m_width = m_height = 0;
|
||||||
m_deleteSecondBitmap = FALSE;
|
m_deleteSecondBitmap = FALSE;
|
||||||
if (m_bitmap1.Ok())
|
if (m_bitmap1.Ok())
|
||||||
@@ -167,7 +183,12 @@ wxToolBarTool *wxToolBarBase::AddTool(int index, const wxBitmap& bitmap, const w
|
|||||||
bool toggle, long xPos, long yPos, wxObject *clientData,
|
bool toggle, long xPos, long yPos, wxObject *clientData,
|
||||||
const wxString& helpString1, const wxString& helpString2)
|
const wxString& helpString1, const wxString& helpString2)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
wxToolBarTool *tool = new wxToolBarTool( (wxToolBar*)this, index, bitmap, pushedBitmap, toggle,
|
||||||
|
(wxObject*) NULL, helpString1, helpString2);
|
||||||
|
#else
|
||||||
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, pushedBitmap, toggle, xPos, yPos, helpString1, helpString2);
|
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, pushedBitmap, toggle, xPos, yPos, helpString1, helpString2);
|
||||||
|
#endif
|
||||||
tool->m_clientData = clientData;
|
tool->m_clientData = clientData;
|
||||||
|
|
||||||
if (xPos > -1)
|
if (xPos > -1)
|
||||||
@@ -698,7 +719,9 @@ void wxToolBarBase::ViewStart (int *x, int *y) const
|
|||||||
|
|
||||||
void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
|
#ifndef __WXGTK__
|
||||||
wxWindow::OnIdle(event);
|
wxWindow::OnIdle(event);
|
||||||
|
#endif
|
||||||
|
|
||||||
DoToolbarUpdates();
|
DoToolbarUpdates();
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,7 @@ LIB_CPP_SRC=\
|
|||||||
common/http.cpp \
|
common/http.cpp \
|
||||||
common/ftp.cpp \
|
common/ftp.cpp \
|
||||||
common/url.cpp \
|
common/url.cpp \
|
||||||
|
common/tbarbase.cpp \
|
||||||
common/tokenzr.cpp \
|
common/tokenzr.cpp \
|
||||||
common/resource.cpp \
|
common/resource.cpp \
|
||||||
common/wxexpr.cpp \
|
common/wxexpr.cpp \
|
||||||
|
@@ -971,9 +971,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, fillStyle );
|
gdk_gc_set_fill( m_brushGC, fillStyle );
|
||||||
|
|
||||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
||||||
{
|
{
|
||||||
|
if (m_brush.GetStipple()->GetPixmap())
|
||||||
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
||||||
|
else
|
||||||
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_HATCH(m_brush.GetStyle()))
|
if (IS_HATCH(m_brush.GetStyle()))
|
||||||
|
@@ -23,39 +23,6 @@
|
|||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxToolBarTool
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
|
||||||
|
|
||||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
|
||||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
|
||||||
bool toggle,
|
|
||||||
wxObject *clientData,
|
|
||||||
const wxString& shortHelpString,
|
|
||||||
const wxString& longHelpString,
|
|
||||||
GtkWidget *item )
|
|
||||||
{
|
|
||||||
m_owner = owner;
|
|
||||||
m_index = theIndex;
|
|
||||||
m_bitmap1 = bitmap1;
|
|
||||||
m_bitmap2 = bitmap2;
|
|
||||||
m_isToggle = toggle;
|
|
||||||
m_enabled = TRUE;
|
|
||||||
m_toggleState = FALSE;
|
|
||||||
m_shortHelpString = shortHelpString;
|
|
||||||
m_longHelpString = longHelpString;
|
|
||||||
m_isMenuCommand = TRUE;
|
|
||||||
m_clientData = clientData;
|
|
||||||
m_deleteSecondBitmap = FALSE;
|
|
||||||
m_item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxToolBarTool::~wxToolBarTool()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "clicked" (internal from gtk_toolbar)
|
// "clicked" (internal from gtk_toolbar)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -971,9 +971,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
|
|
||||||
gdk_gc_set_fill( m_brushGC, fillStyle );
|
gdk_gc_set_fill( m_brushGC, fillStyle );
|
||||||
|
|
||||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
||||||
{
|
{
|
||||||
|
if (m_brush.GetStipple()->GetPixmap())
|
||||||
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
|
||||||
|
else
|
||||||
|
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_HATCH(m_brush.GetStyle()))
|
if (IS_HATCH(m_brush.GetStyle()))
|
||||||
|
@@ -23,39 +23,6 @@
|
|||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxToolBarTool
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
|
||||||
|
|
||||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
|
||||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
|
||||||
bool toggle,
|
|
||||||
wxObject *clientData,
|
|
||||||
const wxString& shortHelpString,
|
|
||||||
const wxString& longHelpString,
|
|
||||||
GtkWidget *item )
|
|
||||||
{
|
|
||||||
m_owner = owner;
|
|
||||||
m_index = theIndex;
|
|
||||||
m_bitmap1 = bitmap1;
|
|
||||||
m_bitmap2 = bitmap2;
|
|
||||||
m_isToggle = toggle;
|
|
||||||
m_enabled = TRUE;
|
|
||||||
m_toggleState = FALSE;
|
|
||||||
m_shortHelpString = shortHelpString;
|
|
||||||
m_longHelpString = longHelpString;
|
|
||||||
m_isMenuCommand = TRUE;
|
|
||||||
m_clientData = clientData;
|
|
||||||
m_deleteSecondBitmap = FALSE;
|
|
||||||
m_item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxToolBarTool::~wxToolBarTool()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "clicked" (internal from gtk_toolbar)
|
// "clicked" (internal from gtk_toolbar)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user