Linux Lib: Toolbar_pro - Create a professional Toolbar
Posted: Fri Feb 16, 2007 6:01 pm
Some month ago I'd released a includefile for creation of a toolbar like the one you can crate on Windows with Danilo's toolbar_pro and some weeks ago a first version of the toolbar_pro.
Now I'd created 2 small user libs containing the following commands :
toolbar_pro:
- CreateTB (tbar.l, hwnd.l, type.l, orientation.l)
Parameters:
tbar.l = a number of your toolbar (i.e 0 or 1 or 2 ...)
hwnd.l= the handle of the window where the Toolbar is created
type.l = one of the following: #GTK_TOOLBAR_TEXT to show text only #GTK_TOOLBAR_BOTH for both, text and Icon , #GTK_TOOLBAR_ICONS for icons only
orientation.l = 0 = horizontal; 1 = vertical
- AddTBbutton(*tbar.l, tb_stock_button.s, Callback_Proc.l, txt.s, img.s)
Parameters:
*tbar.l= the toolbar returned by CreateTB
tb_stockbutton.s= a gtk stock image (can be empty string)
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the toolbarbutton is pressed
txt.s= name the button as you wish (overrides the text from stock image) can be empty string
img.s= use your own image for the button; can be empty string...
- SetTBbuttonTooltip(*tb_button, Tooltip.s)
Parameters:
*tb_button = the button returned by AddTBbutton
Tooltip.s = the tooltip text
- AddTBseparator(*tbar, visible.l, stretch.l)
Parameters:
tbar = the toolbar returned by CreateTB
visible = #true or #false
stretch = #true or #false
- NEW 20.12.2007
- AddTBmenubutton(*tbar.l, tb_stock_button.s, Callback_Proc.l, txt.s, img.s)
Creates a ToolbarButton with Dropdown menu
Parameters:
*tbar = the toolbar returned by CreateTB
tb_stockbutton.s= a gtk stock image (can be empty string)
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the toolbarbutton is pressed
txt.s= name the button as you wish (overrides the text from stock image) can be empty string
img.s= use your own image for the button; can be empty string...
Returns: the handle of the newly created ToolMenuButton
- AddTBmenuButtonEntry(*menutoolbutton,Callback_proc.l, entry.s);
add a menu entry to a MenuToolButton
Parameters:
*menutoolbutton = the handle of the ToolMenuButton returned by AddTBmenubutton()
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the entry is selected
entry.s = the Text for the enty shown in the dropdown list
Returns: the handle for the added entry
- SetTBmenubuttonTooltip(*menutoolbutton,Tooltip.s)
Adds a Tooltip to the given Toolbarbutton's dropdown arrow
Parameters:
*menutoolbutton = the handle of the ToolMenuButton returned by AddTBmenubutton()
Tooltip.s = the tooltip text
Returns: nothing
Download see below
The second lib handels a ComboBox to be used in a Toolbar (I decided to divide this in 2 parts as a toobar does not necessary contain a combobox)
toolbar_pro_combobox
- AddTBcomboBox(*tbar, Callback_Proc.l ,xsize, ysize, list_of_entrys.s)
Parameters
*tbar = the retuned Toolbar from CreateTB()
Callback_Proc = a pointer to a procedure to handle the action when the combobox is used
xsize = the length of the combobox
ysize = the height of the combobox
list_of_entrys = initial content of the combobox; comma seperated string
- GetTBcomboBoxEntryNr(*box)
Parameters
*box = the combobox returned by AddTBcombobox()
returns the actual selected entry or -1 if none
- ClearTBcomboBox(*box)
Parameters
*box = the combobox from which should be clreared
- RemoveTBcomboBoxEntry(*box, entry_nr)
Parameters
*box = the combobox from which a entry should be removed
*entry_nr = the number of the entry
- AddTBcomboBoxEntry(*box, entry.s)
Parameters
*box = the combobox to which a entry should be added
*entry = string to be added
- GetTBcomboBoxEntryName (*box)
Parameters
*box = the combobox from where you want to retrieve the name of the current entry
returns a string containing the text of the selected entry
- NEW 20.12.2007
- SetTBcomboEntryActive(*box,entry_nr.l)
activates the entry number in the given Combobox (this causes an "changed" event)
Parameters:
*box = the combobox to which a entry should be changed
entry_nr.l = the entry number which should be shown (0 = first entry)
Returns: nothing
Download see below
[Edit]19.02.2007 added the description for the combobox commands[/Edit]
[Edit]13.08.2007 added the parameter orientation.l to the CreateTB command [/Edit]
[EDIT]20.12.2007
- added a TollbarMenubutton (3 Commands)
- a new command for the Combobox to select an entry
- added a Textfile with the description of all commands
- added a small demo
- download - now all files are in a single archive
[/Edit]
DOWNLOAD:
http://home.arcor.de/x-linux/pure/toolb ... ar_pro.zip
Now I'd created 2 small user libs containing the following commands :
toolbar_pro:
- CreateTB (tbar.l, hwnd.l, type.l, orientation.l)
Parameters:
tbar.l = a number of your toolbar (i.e 0 or 1 or 2 ...)
hwnd.l= the handle of the window where the Toolbar is created
type.l = one of the following: #GTK_TOOLBAR_TEXT to show text only #GTK_TOOLBAR_BOTH for both, text and Icon , #GTK_TOOLBAR_ICONS for icons only
orientation.l = 0 = horizontal; 1 = vertical
- AddTBbutton(*tbar.l, tb_stock_button.s, Callback_Proc.l, txt.s, img.s)
Parameters:
*tbar.l= the toolbar returned by CreateTB
tb_stockbutton.s= a gtk stock image (can be empty string)
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the toolbarbutton is pressed
txt.s= name the button as you wish (overrides the text from stock image) can be empty string
img.s= use your own image for the button; can be empty string...
- SetTBbuttonTooltip(*tb_button, Tooltip.s)
Parameters:
*tb_button = the button returned by AddTBbutton
Tooltip.s = the tooltip text
- AddTBseparator(*tbar, visible.l, stretch.l)
Parameters:
tbar = the toolbar returned by CreateTB
visible = #true or #false
stretch = #true or #false
- NEW 20.12.2007
- AddTBmenubutton(*tbar.l, tb_stock_button.s, Callback_Proc.l, txt.s, img.s)
Creates a ToolbarButton with Dropdown menu
Parameters:
*tbar = the toolbar returned by CreateTB
tb_stockbutton.s= a gtk stock image (can be empty string)
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the toolbarbutton is pressed
txt.s= name the button as you wish (overrides the text from stock image) can be empty string
img.s= use your own image for the button; can be empty string...
Returns: the handle of the newly created ToolMenuButton
- AddTBmenuButtonEntry(*menutoolbutton,Callback_proc.l, entry.s);
add a menu entry to a MenuToolButton
Parameters:
*menutoolbutton = the handle of the ToolMenuButton returned by AddTBmenubutton()
Callback_Proc= Pointer to a Procedure (that MUST exist) to handle the action when the entry is selected
entry.s = the Text for the enty shown in the dropdown list
Returns: the handle for the added entry
- SetTBmenubuttonTooltip(*menutoolbutton,Tooltip.s)
Adds a Tooltip to the given Toolbarbutton's dropdown arrow
Parameters:
*menutoolbutton = the handle of the ToolMenuButton returned by AddTBmenubutton()
Tooltip.s = the tooltip text
Returns: nothing
Download see below
The second lib handels a ComboBox to be used in a Toolbar (I decided to divide this in 2 parts as a toobar does not necessary contain a combobox)
toolbar_pro_combobox
- AddTBcomboBox(*tbar, Callback_Proc.l ,xsize, ysize, list_of_entrys.s)
Parameters
*tbar = the retuned Toolbar from CreateTB()
Callback_Proc = a pointer to a procedure to handle the action when the combobox is used
xsize = the length of the combobox
ysize = the height of the combobox
list_of_entrys = initial content of the combobox; comma seperated string
- GetTBcomboBoxEntryNr(*box)
Parameters
*box = the combobox returned by AddTBcombobox()
returns the actual selected entry or -1 if none
- ClearTBcomboBox(*box)
Parameters
*box = the combobox from which should be clreared
- RemoveTBcomboBoxEntry(*box, entry_nr)
Parameters
*box = the combobox from which a entry should be removed
*entry_nr = the number of the entry
- AddTBcomboBoxEntry(*box, entry.s)
Parameters
*box = the combobox to which a entry should be added
*entry = string to be added
- GetTBcomboBoxEntryName (*box)
Parameters
*box = the combobox from where you want to retrieve the name of the current entry
returns a string containing the text of the selected entry
- NEW 20.12.2007
- SetTBcomboEntryActive(*box,entry_nr.l)
activates the entry number in the given Combobox (this causes an "changed" event)
Parameters:
*box = the combobox to which a entry should be changed
entry_nr.l = the entry number which should be shown (0 = first entry)
Returns: nothing
Download see below
[Edit]19.02.2007 added the description for the combobox commands[/Edit]
[Edit]13.08.2007 added the parameter orientation.l to the CreateTB command [/Edit]
[EDIT]20.12.2007
- added a TollbarMenubutton (3 Commands)
- a new command for the Combobox to select an entry
- added a Textfile with the description of all commands
- added a small demo
- download - now all files are in a single archive
[/Edit]
DOWNLOAD:
http://home.arcor.de/x-linux/pure/toolb ... ar_pro.zip