Libs : dashed splitterbar & requester position ( PB 3.94

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

really, really, really good userlib. Very thank you. Adopted ! :P
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

thx ;)

[ Updated ]
minor fix : FreeGadget
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

[ Released ]

version : 1.2
- new ID parameter for DashBarDrawer
- Don't move the grip button when window is minimized ( for PureResize lib compatibility )

download : here ( Extract to your PB folder and restart your PB compiler. )

Code: Select all

Enumeration 
   #GADGET1 
   #GADGET2 
   #GADGET3 
   #DASHBAR  
   #DASHBAR2 
EndEnumeration 

; =======
; bar drawing procedure
; =======

Procedure MyBarDrawing(id, w, h, State, flag)
   ;color mode 
   Select id 
      Case #DASHBAR 
         If State=0
            buttonColor=RGB($C9,$EF,$FA)
         Else 
            buttonColor=RGB($D7,$DB,$DF)
         EndIf       
      Case #DASHBAR2
         If State=0
            buttonColor=RGB(255,0,0)
         Else 
            buttonColor=RGB($D7,$DB,$DF)
         EndIf 
   EndSelect
   
   Select flag 
      Case #DashedBar_Horizontal
         ;background
         Box(0,0,w,h,buttonColor)
         
         ;borders
         Line(0,0,0,h,GetSysColor_(#COLOR_BTNSHADOW))
         Line(1,0,0,h,GetSysColor_(#COLOR_BTNHILIGHT))
         
         Line(w-2,0,0,h,GetSysColor_(#COLOR_BTNSHADOW))
         Line(w-1,0,0,h,GetSysColor_(#COLOR_BTNHILIGHT)) 
         
         ;dots
         For x=10 To w-10 Step 3
            Line(x,h/2-1,1,2,GetSysColor_(#COLOR_BTNSHADOW)) 
         Next
         
      Case #DashedBar_Vertical 
         ;background   
         Box(0,0,w,h,buttonColor)
         
         ;borders
         Line(0,0,w,0,GetSysColor_(#COLOR_BTNSHADOW))
         Line(0,1,w,0,GetSysColor_(#COLOR_BTNHILIGHT))
         
         Line(0,h-2,w,0,GetSysColor_(#COLOR_BTNSHADOW))
         Line(0,h-1,w,0,GetSysColor_(#COLOR_BTNHILIGHT)) 
         
         ;dots
         For y=10 To h-10 Step 3
            Line(w/2-1,y,2,1,GetSysColor_(#COLOR_BTNSHADOW)) 
         Next
   EndSelect
EndProcedure






; ======================================
; EXAMPLE : 3-Panel-Window 
; ======================================

OpenWindow(0,100,100,300,300,#PB_Window_SystemMenu|#PB_Window_SizeGadget,"dashed bar") 
CreateGadgetList(WindowID()) 

; [LEFT | MIDDLE | MIDDLE]
ButtonGadget(#GADGET1,0,0,0,0,"left") 
ButtonGadget(#GADGET3,0,0,0,0,"middle") 
ButtonGadget(#GADGET2,0,0,0,0,"right") 

DashedBarInit(@MyBarDrawing())

;SECONDARY dashedbar [LEFT | MIDDLE]
DashedBarGadget(#DASHBAR,5,5,290,290,6,100,#GADGET1,#GADGET3,#DashedBar_Vertical) 
DashedBarAttribute(#DASHBAR,32,32,#DashedBar_FavoriteBorder1) 
SetGadgetState(#DASHBAR,290/3-6)

;MAIN dashedbar [.... | RIGHT]
DashedBarGadget(#DASHBAR2,5,5,290,290,6,100,#DASHBAR,#GADGET2,#DashedBar_Vertical)  
DashedBarAttribute(#DASHBAR2,32,32,#DashedBar_FavoriteBorder2) 
SetGadgetState(#DASHBAR2,2*290/3-6)

Repeat 
   e=WaitWindowEvent() 
   
   ;resize MAIN dashedbar
   If e=#PB_Event_SizeWindow 
      UseWindow(0) 
      w=WindowWidth() 
      h=WindowHeight() 
      ResizeGadget(#DASHBAR2,5,5,w-10,h-10) 
   EndIf 
   
Until e=#PB_Event_CloseWindow
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

[ Released ]

download : here ( Extract to your PB folder and restart your PB compiler. )

version : 1.3

- bug fixed : default grip rendering causes crash (version 1.2)
- added : the splitter bar follows its favorite border
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

[released]

- added : DashedBarSetGadget ( replace one of two gadgets )
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Damn it! If I'd known about your lib it would have saved me the bother of coding a splitter myself! :D

Will this work with PB 4?
I may look like a mule, but I'm not a complete ass.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

srod wrote:Damn it! If I'd known about your lib it would have saved me the bother of coding a splitter myself! :D

Will this work with PB 4?

It depends on Tailbite.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Some news ?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

what kind of news ?
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Ready for PB V4 ?
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Will this lib be updated for latest PB4?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

no time to finish the conversion for the moment... ( .NET wormhole )

I can release the source code (if I found where I lost it )
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Post Reply