[Linux 3.94] Professional Toolbar - includefile -
Posted: Sun Jul 02, 2006 4:29 pm
Hi,
here is an includefile for creating a professional looking toolbar which (maybe with 4,0) could be transformed in a UserLib (isn't possible at the moment.. (see my las post in this thread http://www.purebasic.fr/english/viewtop ... 096#152096)... maybe someone has a hint.... :roll:
Anyway, creating a toolbar on linux with builtin-gfx or your own gfx is easy as it could be. Here is a small snipet which demonstrates this:
I hope, the comments are satisfying...
There are 4 commands at the moment - CreateTB(), AddTBbutton(), AddTBseparator() and SetTBtooltip() (taken the same names as TBPro on win... but unfortunately the parameters are completely different)
You can use nearly all images known by gtk2 (even ico-format) without a coresponding Imagedcoder...
The heigth of the Toolbar-buttons are always depending on the largest mage....
A Warning. NEVER use When using the toolbar... Due to an error (i think it's one) of PB-Linux the images (predefined Stock-Images) weren't displayed any more....
At least: here is a screenshot of the demo

and, of course, the includefile:
http://home.arcor.de/x-linux/pure/toolbar_pro.pb
Compile with GTK2 as subsystem
Comments, error reports (or missing functions), questions etc. are appreciated
enjoy
here is an includefile for creating a professional looking toolbar which (maybe with 4,0) could be transformed in a UserLib (isn't possible at the moment.. (see my las post in this thread http://www.purebasic.fr/english/viewtop ... 096#152096)... maybe someone has a hint.... :roll:
Anyway, creating a toolbar on linux with builtin-gfx or your own gfx is easy as it could be. Here is a small snipet which demonstrates this:
Code: Select all
Demo-application:
IncludeFile "toolbar_pro.pb"
;the Procedures called by the Toolbarbuttons MUST be in the CDLL format!!
ProcedureCDLL meineproc()
;your code here
EndProcedure
ProcedureCDLL meineproc1()
;your code here
EndProcedure
ProcedureCDLL meineproc2()
;your code here
End
EndProcedure
*hwnd=OpenWindow(0,0,0,700,300,#PB_Window_ScreenCentered,"Toolbar")
If CreateGadgetList(*hwnd)
;create a toolbar
*tool=CreateTB(0,WindowID(),#GTK_TOOLBAR_BOTH);one of #GTK_TOOLBAR_ICONS, #GTK_TOOLBAR_TEXT or #GTK_TOOLBAR_BOTH
;the buttons
*btn=AddTBbutton(*tool,"gtk-new",@meineproc(),"",""); a standard button with standard image and text - leave the last 2 parameter empty
SetTBbuttonTooltip(*btn,*tooltips,"Demo tooltip")
AddTBseparator(*tool,#FALSE)
*btn1=AddTBbutton(*tool,"gtk-open",@meineproc1(),"",""); a standard button with standard image and text
SetTBbuttonTooltip(*btn1,*tooltips,"another tooltip")
AddTBseparator(*tool,#FALSE)
*btn2=AddTBbutton(*tool,"gtk-delete",@meineproc1(),"",""); a standard button with standard image and text
SetTBbuttonTooltip(*btn2,*tooltips,"delete something.....")
*btn3=AddTBbutton(*tool,"gtk-missing-image",@meineproc1(),"Press this Button","/home/user/lin_.png"); a button with own image and own text - fill the last 2 parameter
;if the image doesn't exist, the named button-image will be taken, if this parameter is set to "", an empty image will be generated
SetTBbuttonTooltip(*btn3,*tooltips,"VERY IMPRESSIVE")
AddTBseparator(*tool,#True);if #true, the button(s) after this will be on the most right side of the window
*btn4=AddTBbutton(*tool,"gtk-quit",@meineproc2(),"MyExit",""); a button with standard image and own text - leave only he last parameter empty
SetTBbuttonTooltip(*btn4,*tooltips,"Exit")
; other PB-Gadgets
PanelGadget(0,10,5,680,200)
AddGadgetItem(0,-1,"Tab1")
CloseGadgetList()
EndIf
Repeat
ev = WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
End
There are 4 commands at the moment - CreateTB(), AddTBbutton(), AddTBseparator() and SetTBtooltip() (taken the same names as TBPro on win... but unfortunately the parameters are completely different)
You can use nearly all images known by gtk2 (even ico-format) without a coresponding Imagedcoder...

The heigth of the Toolbar-buttons are always depending on the largest mage....
A Warning. NEVER use
Code: Select all
UsePNGImagexxxx()
At least: here is a screenshot of the demo

and, of course, the includefile:
http://home.arcor.de/x-linux/pure/toolbar_pro.pb
Compile with GTK2 as subsystem
Comments, error reports (or missing functions), questions etc. are appreciated
enjoy
