Page 1 sur 1

Rebar

Publié : mar. 27/mai/2008 6:37
par Anonyme2
J'ai travaillé avec les rebar pour avoir des barres d'outils flottantes ou non, elles sont plus jolies que les toolbars classiques.

Vous savez si quelqu'un a écrit une lib pour ces Rebar ?
Peut-être qu'en natif ça serait l'idéal !


ça donne des toolbars comme ceci

Image

A+
Denis

Publié : mar. 27/mai/2008 6:57
par Jacobus
Sûr que c'est un gros manque à PB et d'avoir de telles possibilités en natif serait un vrai plus...

Publié : mar. 27/mai/2008 17:04
par Patrick88
sur le forum anglais , un gars à créer une lib qu'il vend

code de la rebar style office97

Code : Tout sélectionner

; Rebar Control by Sparkie 07/22/2004
; http://www.purebasic.fr/german/viewtopic.php?t=7306&highlight=rebar

#TB_GETBUTTONSIZE = #WM_USER + 58

Structure myINITCOMMONCONTROLSEX
dwSize.l
dwICC.l
EndStructure

Procedure.l CreateRebar(hwndOwner, hwndST, hwndTB, hwndCB)
  rbi.REBARINFO
  rbBand.REBARBANDINFO
  rc.RECT
  icex.myINITCOMMONCONTROLSEX
   
  icex\dwSize = SizeOf(myINITCOMMONCONTROLSEX)
  icex\dwICC  = #ICC_COOL_CLASSES | #ICC_BAR_CLASSES

  InitCommonControlsEx_(@icex)

  hwndRB = CreateWindowEx_(#WS_EX_TOOLWINDOW, "ReBarWindow32", #Null, #WS_CHILD | #WS_VISIBLE | #WS_CLIPSIBLINGS | #WS_CLIPCHILDREN | #RBS_VARHEIGHT | #CCS_NODIVIDER, 0, 0, 0, 0, hwndOwner, #Null,  GetModuleHandle_(0), #Null)
  rbi\cbSize = SizeOf(REBARINFO)
  rbi\fMask  = 0
  rbi\himl = #Null
  SendMessage_(hwndRB, #RB_SETBARINFO, 0, @rbi)
  rbBand\cbSize = SizeOf(REBARBANDINFO)
  rbBand\fMask  = #RBBIM_COLORS | #RBBIM_TEXT | #RBBIM_STYLE | #RBBIM_CHILD  | #RBBIM_CHILDSIZE | #RBBIM_SIZE;
  rbBand\fStyle = #RBBS_CHILDEDGE
;/ turn off XP Skin support to see your color choices in the Rebar here
  rbBand\clrBack = RGB(200, 200, 128)
  rbBand\clrFore = RGB(64, 100, 0)

;/ Set values for band with the StringGadget
  GetWindowRect_(hwndST, @rc)
  sttext$ = "String"
  rbBand\lpText = @sttext$                  ; text to display for StringGadget
  rbBand\hwndChild = hwndST                 ; handle to our STringGadget
  rbBand\cxMinChild = 100                   ; min width of band (0 hides gadget)
  rbBand\cyMinChild = rc\bottom - rc\top    ; min height of band
  rbBand\cx = 200                           ; width of band
         
;/ Add the band with the StringGadget
  SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
       
;/ Get the height of the ToolBar we created earlier
  dwBtnSize = SendMessage_(hwndTB, #TB_GETBUTTONSIZE, 0,0)
         
;/ Set values for band with the ToolBar
  tbtext$ = "ToolBar"
  rbBand\lpText = @tbtext$                  ; text to display for ToolBar
  rbBand\hwndChild = hwndTB                 ; handle to our ToolBar
  rbBand\cxMinChild = 100                   ; min width of band (0 hides ToolBar)
  rbBand\cyMinChild = dwBtnSize>>16         ; min height of band set to button height
  rbBand\cx = 200                           ; width of band
         
;/ Add the band that has the toolbar.
  SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand);

;/ Set values for the band with the ComboBox
  GetWindowRect_(hwndCB, @rc);
  cbtext$ = "ComboBox"
  rbBand\lpText = @cbtext$                  ; text to display for ToolBar
  rbBand\hwndChild = hwndCB                 ; handle to our ComboBOxGadget
  rbBand\cxMinChild = 100                   ; min width of band (0 hides ComboBox)
  rbBand\cyMinChild = rc\bottom - rc\top    ; min height of band
  rbBand\cx = 300                           ; width of band
         
;/ Add the band that has the combobox
  SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand);

  ProcedureReturn hwndRB;
EndProcedure
       
If OpenWindow(0, 50, 50, 700, 200, "Rebar Control", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  If CreateGadgetList(WindowID(0))
    hStGad = StringGadget(0, 10, 50, 150, 20, "Hello World")
    hTbGad = CreateToolBar(0, WindowID(0));
    ToolBarStandardButton(0, #PB_ToolBarIcon_New)
    ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
    ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
    SetWindowLong_(hTbGad, #GWL_EXSTYLE, 128)       ; best I can do for now
    SetWindowLong_(hTbGad, #GWL_STYLE, 1442879821)  ; best I can do for now
    hCbGad = ComboBoxGadget(1, 10, 100, 100, 200)
      For a=1 To 5
        AddGadgetItem(1, -1, "ComboBox item " + Str(a))
      Next
    SetGadgetState(1,0)
    TextGadget(2, 200, 100, 400, 20, "Clicking on any of the text labels in the Rebar also resizes the band.")
    TextGadget(3, 200, 130, 400, 20, "Click and drag on any of the text labels to reposition the bands.")
    CreateRebar(WindowID(0), hStGad, hTbGad, hCbGad)
  EndIf
EndIf
     
Repeat
         
  Event = WaitWindowEvent()

    Select Event
     
      Case #PB_Event_Menu
       
        If Event = #PB_Event_Menu
          SetGadgetText(0, "ToolBar ID: " + Str(EventMenu()))
        EndIf
        
     	Case #RB_BEGINDRAG
     		Debug "begin drag"
     		
      Case #PB_Event_Gadget
       
        If EventGadget() = 1
          SetGadgetText(0, GetGadgetText(1))
        EndIf
       
       
      Case #PB_Event_CloseWindow
        Quit = #True
             
    EndSelect
         
Until Quit = #True
       
End 

Publié : mar. 27/mai/2008 18:07
par Anonyme2
La toolbar que j'ai affiché est celle du projet que j'essaye de développer.
J'ai cherché des codes sur des forum et j'ai pondu cette toolbar.

Voilà un petit projet intéressant pour créer une jeu de fonctions sans avoir à gérer les API en direct.

ça serait bien 'avoir des commandes permettant d'ajouter des gadgets ou menu aux Rebar.

Si vous avez du courage :D

@Patrick88:
Tu as vu des échos de cette lib ? et le prix ?

A+

Publié : mer. 28/mai/2008 20:09
par Patrick88
Denis a écrit :@Patrick88:
Tu as vu des échos de cette lib ? et le prix ?

A+
non, j'ai essayé de retrouver le lien hier soir, mais y'a telement de post qui en cause que j'ai jeté l'éponge

je recherche le code pour les créer des barres d'outils à la msoffice celle que l'on peut "décrocher" et placer sur les cotés ou mettre en flottante...

pat

Publié : jeu. 29/mai/2008 14:45
par SpaceMan
la lib dont parle Patrick88 s'appelle ProGUI et est vraiment très interressante et se vendait à 19.99$ mais le développeur serait porté disparu. bref plus aucune nouvelle de lui.
tu peux le tester ici
http://www.purebasic.fr/english/viewtop ... 45&start=0

Publié : jeu. 29/mai/2008 17:57
par nico
C'est dommage parce que ce genre de code, on en trouve écrit en C++, mais il faut être capable de le porter.

Publié : jeu. 29/mai/2008 18:56
par Anonyme2
Sinon la barre que j'ai affiché, c'est mon code mais j'ai pas la frite pour bosser, je suis en train de me reconvertir enfin j'essaye alors j'ai pas beaucoup de temps pour le reste.

A+

Publié : jeu. 29/mai/2008 20:13
par Jacobus
C'est plutôt réussi pourtant cette barre d'outils, dommage!
Et c'est quoi ta reconversion? (si c'est pas indiscret, sinon bon courage.)