Added ToogleTool from Markus
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,7 +53,8 @@ class wxToolBarTool: public wxObject
|
|||||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
||||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||||
bool toggle = FALSE, wxObject *clientData = NULL,
|
bool toggle = FALSE, wxObject *clientData = NULL,
|
||||||
const wxString& shortHelpString = "", const wxString& longHelpString = "");
|
const wxString& shortHelpString = "", const wxString& longHelpString = "",
|
||||||
|
GtkWidget *item = NULL );
|
||||||
~wxToolBarTool(void);
|
~wxToolBarTool(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -71,6 +72,7 @@ class wxToolBarTool: public wxObject
|
|||||||
wxString m_shortHelpString;
|
wxString m_shortHelpString;
|
||||||
wxString m_longHelpString;
|
wxString m_longHelpString;
|
||||||
wxToolBar *m_owner;
|
wxToolBar *m_owner;
|
||||||
|
GtkWidget *m_item;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -53,7 +53,8 @@ class wxToolBarTool: public wxObject
|
|||||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
||||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||||
bool toggle = FALSE, wxObject *clientData = NULL,
|
bool toggle = FALSE, wxObject *clientData = NULL,
|
||||||
const wxString& shortHelpString = "", const wxString& longHelpString = "");
|
const wxString& shortHelpString = "", const wxString& longHelpString = "",
|
||||||
|
GtkWidget *item = NULL );
|
||||||
~wxToolBarTool(void);
|
~wxToolBarTool(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -71,6 +72,7 @@ class wxToolBarTool: public wxObject
|
|||||||
wxString m_shortHelpString;
|
wxString m_shortHelpString;
|
||||||
wxString m_longHelpString;
|
wxString m_longHelpString;
|
||||||
wxToolBar *m_owner;
|
wxToolBar *m_owner;
|
||||||
|
GtkWidget *m_item;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -25,7 +25,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
|||||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
||||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
||||||
bool toggle, wxObject *clientData,
|
bool toggle, wxObject *clientData,
|
||||||
const wxString& shortHelpString, const wxString& longHelpString )
|
const wxString& shortHelpString, const wxString& longHelpString,
|
||||||
|
GtkWidget *item )
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_index = theIndex;
|
m_index = theIndex;
|
||||||
@@ -39,11 +40,12 @@ wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
|||||||
m_isMenuCommand = TRUE;
|
m_isMenuCommand = TRUE;
|
||||||
m_clientData = clientData;
|
m_clientData = clientData;
|
||||||
m_deleteSecondBitmap = FALSE;
|
m_deleteSecondBitmap = FALSE;
|
||||||
};
|
m_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
wxToolBarTool::~wxToolBarTool()
|
wxToolBarTool::~wxToolBarTool()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
@@ -56,7 +58,7 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
|
|||||||
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
|
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
|
||||||
|
|
||||||
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
|
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
|
||||||
};
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -67,18 +69,18 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxToolBar::wxToolBar()
|
wxToolBar::wxToolBar()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxString& name )
|
long style, const wxString& name )
|
||||||
{
|
{
|
||||||
Create( parent, id, pos, size, style, name );
|
Create( parent, id, pos, size, style, name );
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBar::~wxToolBar()
|
wxToolBar::~wxToolBar()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
@@ -103,7 +105,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
||||||
{
|
{
|
||||||
@@ -115,7 +117,7 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
|||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
@@ -124,7 +126,7 @@ void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouseEnter( int toolIndex )
|
void wxToolBar::OnMouseEnter( int toolIndex )
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ void wxToolBar::OnMouseEnter( int toolIndex )
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||||
const wxBitmap& pushedBitmap, bool toggle,
|
const wxBitmap& pushedBitmap, bool toggle,
|
||||||
@@ -143,7 +145,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
if (!bitmap.Ok()) return NULL;
|
if (!bitmap.Ok()) return NULL;
|
||||||
|
|
||||||
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
|
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
|
||||||
clientData, helpString1, helpString2 );
|
clientData, helpString1, helpString2 );
|
||||||
|
|
||||||
GdkPixmap *pixmap = bitmap.GetPixmap();
|
GdkPixmap *pixmap = bitmap.GetPixmap();
|
||||||
|
|
||||||
@@ -156,23 +158,23 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
|
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
|
||||||
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
|
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
|
||||||
|
|
||||||
gtk_toolbar_append_element( m_toolbar,
|
tool->m_item = gtk_toolbar_append_element( m_toolbar, ctype, NULL, NULL, helpString1, "", tool_pixmap,
|
||||||
ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
|
(GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
|
||||||
|
|
||||||
m_tools.Append( tool );
|
m_tools.Append( tool );
|
||||||
|
|
||||||
return tool;
|
return tool;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::AddSeparator(void)
|
void wxToolBar::AddSeparator(void)
|
||||||
{
|
{
|
||||||
gtk_toolbar_append_space( m_toolbar );
|
gtk_toolbar_append_space( m_toolbar );
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::ClearTools(void)
|
void wxToolBar::ClearTools(void)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxToolBar::ClearTools not implemented"));
|
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" );
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::Realize(void)
|
void wxToolBar::Realize(void)
|
||||||
{
|
{
|
||||||
@@ -189,13 +191,13 @@ void wxToolBar::Realize(void)
|
|||||||
{
|
{
|
||||||
int tool_height = tool->m_bitmap1.GetHeight();
|
int tool_height = tool->m_bitmap1.GetHeight();
|
||||||
if (tool_height > m_height) m_height = tool_height;
|
if (tool_height > m_height) m_height = tool_height;
|
||||||
};
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
m_height += 10;
|
m_height += 10;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
||||||
{
|
{
|
||||||
@@ -209,15 +211,31 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
};
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
}
|
||||||
|
|
||||||
void wxToolBar::ToggleTool(int WXUNUSED(toolIndex), bool WXUNUSED(toggle) )
|
void wxToolBar::ToggleTool( int toolIndex, bool toggle )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxToolBar::ToggleTool not implemented"));
|
wxNode *node = m_tools.First();
|
||||||
};
|
while (node)
|
||||||
|
{
|
||||||
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
|
if (tool->m_index == toolIndex)
|
||||||
|
{
|
||||||
|
tool->m_toggleState = toggle;
|
||||||
|
if ((tool->m_item) && (GTK_IS_TOGGLE_BUTTON(tool->m_item)))
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(tool->m_item), toggle );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
}
|
||||||
|
|
||||||
wxObject *wxToolBar::GetToolClientData(int index) const
|
wxObject *wxToolBar::GetToolClientData( int index ) const
|
||||||
{
|
{
|
||||||
wxNode *node = m_tools.First();
|
wxNode *node = m_tools.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -225,9 +243,12 @@ wxObject *wxToolBar::GetToolClientData(int index) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == index) return tool->m_clientData;;
|
if (tool->m_index == index) return tool->m_clientData;;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return (wxObject*)NULL;
|
return (wxObject*)NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::GetToolState(int toolIndex) const
|
bool wxToolBar::GetToolState(int toolIndex) const
|
||||||
{
|
{
|
||||||
@@ -237,9 +258,12 @@ bool wxToolBar::GetToolState(int toolIndex) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == toolIndex) return tool->m_toggleState;
|
if (tool->m_index == toolIndex) return tool->m_toggleState;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
||||||
{
|
{
|
||||||
@@ -249,20 +273,23 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == toolIndex) return tool->m_enabled;
|
if (tool->m_index == toolIndex) return tool->m_enabled;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
|
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
|
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetToolSeparation( int separation )
|
void wxToolBar::SetToolSeparation( int separation )
|
||||||
{
|
{
|
||||||
gtk_toolbar_set_space_size( m_toolbar, separation );
|
gtk_toolbar_set_space_size( m_toolbar, separation );
|
||||||
};
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
|||||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
||||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
||||||
bool toggle, wxObject *clientData,
|
bool toggle, wxObject *clientData,
|
||||||
const wxString& shortHelpString, const wxString& longHelpString )
|
const wxString& shortHelpString, const wxString& longHelpString,
|
||||||
|
GtkWidget *item )
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_index = theIndex;
|
m_index = theIndex;
|
||||||
@@ -39,11 +40,12 @@ wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
|||||||
m_isMenuCommand = TRUE;
|
m_isMenuCommand = TRUE;
|
||||||
m_clientData = clientData;
|
m_clientData = clientData;
|
||||||
m_deleteSecondBitmap = FALSE;
|
m_deleteSecondBitmap = FALSE;
|
||||||
};
|
m_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
wxToolBarTool::~wxToolBarTool()
|
wxToolBarTool::~wxToolBarTool()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
@@ -56,7 +58,7 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
|
|||||||
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
|
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
|
||||||
|
|
||||||
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
|
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
|
||||||
};
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -67,18 +69,18 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxToolBar::wxToolBar()
|
wxToolBar::wxToolBar()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxString& name )
|
long style, const wxString& name )
|
||||||
{
|
{
|
||||||
Create( parent, id, pos, size, style, name );
|
Create( parent, id, pos, size, style, name );
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBar::~wxToolBar()
|
wxToolBar::~wxToolBar()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
@@ -103,7 +105,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
||||||
{
|
{
|
||||||
@@ -115,7 +117,7 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
|||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
@@ -124,7 +126,7 @@ void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouseEnter( int toolIndex )
|
void wxToolBar::OnMouseEnter( int toolIndex )
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ void wxToolBar::OnMouseEnter( int toolIndex )
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||||
const wxBitmap& pushedBitmap, bool toggle,
|
const wxBitmap& pushedBitmap, bool toggle,
|
||||||
@@ -143,7 +145,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
if (!bitmap.Ok()) return NULL;
|
if (!bitmap.Ok()) return NULL;
|
||||||
|
|
||||||
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
|
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
|
||||||
clientData, helpString1, helpString2 );
|
clientData, helpString1, helpString2 );
|
||||||
|
|
||||||
GdkPixmap *pixmap = bitmap.GetPixmap();
|
GdkPixmap *pixmap = bitmap.GetPixmap();
|
||||||
|
|
||||||
@@ -156,23 +158,23 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
|
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
|
||||||
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
|
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
|
||||||
|
|
||||||
gtk_toolbar_append_element( m_toolbar,
|
tool->m_item = gtk_toolbar_append_element( m_toolbar, ctype, NULL, NULL, helpString1, "", tool_pixmap,
|
||||||
ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
|
(GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
|
||||||
|
|
||||||
m_tools.Append( tool );
|
m_tools.Append( tool );
|
||||||
|
|
||||||
return tool;
|
return tool;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::AddSeparator(void)
|
void wxToolBar::AddSeparator(void)
|
||||||
{
|
{
|
||||||
gtk_toolbar_append_space( m_toolbar );
|
gtk_toolbar_append_space( m_toolbar );
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::ClearTools(void)
|
void wxToolBar::ClearTools(void)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxToolBar::ClearTools not implemented"));
|
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" );
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::Realize(void)
|
void wxToolBar::Realize(void)
|
||||||
{
|
{
|
||||||
@@ -189,13 +191,13 @@ void wxToolBar::Realize(void)
|
|||||||
{
|
{
|
||||||
int tool_height = tool->m_bitmap1.GetHeight();
|
int tool_height = tool->m_bitmap1.GetHeight();
|
||||||
if (tool_height > m_height) m_height = tool_height;
|
if (tool_height > m_height) m_height = tool_height;
|
||||||
};
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
m_height += 10;
|
m_height += 10;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
||||||
{
|
{
|
||||||
@@ -209,15 +211,31 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
};
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
}
|
||||||
|
|
||||||
void wxToolBar::ToggleTool(int WXUNUSED(toolIndex), bool WXUNUSED(toggle) )
|
void wxToolBar::ToggleTool( int toolIndex, bool toggle )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxToolBar::ToggleTool not implemented"));
|
wxNode *node = m_tools.First();
|
||||||
};
|
while (node)
|
||||||
|
{
|
||||||
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
|
if (tool->m_index == toolIndex)
|
||||||
|
{
|
||||||
|
tool->m_toggleState = toggle;
|
||||||
|
if ((tool->m_item) && (GTK_IS_TOGGLE_BUTTON(tool->m_item)))
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(tool->m_item), toggle );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
}
|
||||||
|
|
||||||
wxObject *wxToolBar::GetToolClientData(int index) const
|
wxObject *wxToolBar::GetToolClientData( int index ) const
|
||||||
{
|
{
|
||||||
wxNode *node = m_tools.First();
|
wxNode *node = m_tools.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -225,9 +243,12 @@ wxObject *wxToolBar::GetToolClientData(int index) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == index) return tool->m_clientData;;
|
if (tool->m_index == index) return tool->m_clientData;;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return (wxObject*)NULL;
|
return (wxObject*)NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::GetToolState(int toolIndex) const
|
bool wxToolBar::GetToolState(int toolIndex) const
|
||||||
{
|
{
|
||||||
@@ -237,9 +258,12 @@ bool wxToolBar::GetToolState(int toolIndex) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == toolIndex) return tool->m_toggleState;
|
if (tool->m_index == toolIndex) return tool->m_toggleState;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
||||||
{
|
{
|
||||||
@@ -249,20 +273,23 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
|
|||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (tool->m_index == toolIndex) return tool->m_enabled;
|
if (tool->m_index == toolIndex) return tool->m_enabled;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "wrong toolbar index" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
|
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
|
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
void wxToolBar::SetToolSeparation( int separation )
|
void wxToolBar::SetToolSeparation( int separation )
|
||||||
{
|
{
|
||||||
gtk_toolbar_set_space_size( m_toolbar, separation );
|
gtk_toolbar_set_space_size( m_toolbar, separation );
|
||||||
};
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user