$H windows.ph
$H messages.ph
STRUCT RECT = Left&,Righ&,Top&,Bottom&
Declarar bereich#,be#,objeto#,erg&,erg2&,x&,y&,links1&,oben1&,links2&,oben2&
Dim be#,8
Dim bereich#,1024
Dim objeto#,16
' Ermittelt el Handle bajo el Mauszeiger
Proc MPos
~GetCursorPos(be#)
x&=Largo(be#,0)
y&=Largo(be#,4)
erg&=~WindowFromPoint(x&,y&)
ENDPROC
' Verschiebt el Toolbar
Proc MoveIt
Parámetros wnd&,lParam&
~GetClientRect(wnd&,R#)
~MapWindowPoints(wnd&,%hwnd,R#,2)
If ~PtInRect(R#,LoWord(lParam&),HiWord(lParam&))
~Captura de lanzamiento()
UseCursor 5
SendMessage(wnd&,~WM_SYSCOMMAND,~SC_MOVE+1,0)
UseCursor 0
Volver 0
endif
Volver 1
ENDPROC
Proc PosInWnd
Claro objeto#
~GetWindowRect(STB1&,objeto#)
~ScreenToClient(%HWND,objeto#)
links1&=Largo(objeto#,0)
oben1&=Largo(objeto#,4)
Claro objeto#
~GetWindowRect(STB2&,objeto#)
~ScreenToClient(%HWND,objeto#)
links2&=Largo(objeto#,0)
oben2&=Largo(objeto#,4)
ENDPROC
' Ausrichten
Proc UpdateToolbar
Parámetros TB%,handle&
PosInWnd
if TB%=1
if links1&<5
SetWindowpos STB1&=0,2-width(STB1&),32;0
SetWindowpos STB2&=width(STB1&),2-width(STB2&),32;0
elseif links1&>width(STB1&)
SetWindowpos STB2&=0,2-width(STB2&),32;0
SetWindowpos STB1&=width(STB2&),2-width(STB1&),32;0
más
if links2&=0
SetWindowpos STB1&=width(STB2&),2-width(STB1&),32;0
más
SetWindowpos STB1&=0,2-width(STB1&),32;0
endif
endif
elseif TB%=2
if links2&<5
SetWindowpos STB2&=0,2-width(STB2&),32;0
SetWindowpos STB1&=width(STB2&),2-width(STB1&),32;0
elseif links2&>width(STB2&)
SetWindowpos STB2&=width(STB1&),2-width(STB2&),32;0
SetWindowpos STB1&=0,2-width(STB1&),32;0
más
if links1&=0
SetWindowpos STB2&=width(STB1&),2-width(STB2&),32;0
más
SetWindowpos STB2&=0,2-width(STB2&),32;0
endif
endif
endif
ENDPROC
' Ventana principal
Ventana de Estilo 24
Título de la ventana "Abreißbare Toolbar"
Ventana %maxX/2-320,(%maxY/2-240)-640,480
Cls ~GetSysColor(16)
USEP 0,1,~GetSysColor(15)
UseBrush 1,~GetSysColor(15)
Rectángulo 0,0-%maxX,36
USEP 0,1,~GetSysColor(15)
Line 0,0-%maxX,0
USEP 0,1,RGB(255,255,255)
Line 0,1-%maxX,1
USEP 0,1,0
Line 0,34-%maxX,34
USEP 0,1,RGB(255,255,255)
Line 0,35-%maxX,35
var CB&=Crear("CheckBox",%hwnd,"Ausrichten",530,420,90,20)
SetCheck CB&,1
var STB1&=Control("DIÁLOGO","",$54000000,0,2,105,32,%hwnd,0,%hInstance)
var SB1&=Crear("Button",STB1&,"",4,2,4,28)
EnableWindow SB1&,0
var STB2&=Control("DIÁLOGO","",$54000000,105,2,136,32,%hwnd,0,%hInstance)
var SB2&=Crear("Button",STB2&,"",4,2,4,28)
EnableWindow SB2&,0
var TB1&=Control("DIÁLOGO","",$54000000,10,0,95,32,STB1&,0,%hInstance)
var TB2&=Control("DIÁLOGO","",$54000000,10,0,126,32,STB2&,0,%hInstance)
var long hBild = create("HPIC", -1, $PROGDIR+"test24.bmp")' <-------------- ggf. ANPASSEN !!!
var long hBildliste = create("ImageList", 24, 24, hBild, rgb(192,192,192))
var long hToolbar1 = create("Toolbar", TB1&, hBildliste,0,0,2000,1)
var long hToolbar2 = create("Toolbar", TB2&, hBildliste,0,0,2000,1)
deleteobject hBild
Toolbar("AddButton", hToolbar1, 0, 100, "Neue Datei")
Toolbar("AddButton", hToolbar1, 1, 101, "Datei öffnen")
Toolbar("AddButton", hToolbar1, 2, 102, "Datei speichern")
Toolbar("AddButton", hToolbar2, 5, 200, "Ausschneiden")
Toolbar("AddButton", hToolbar2, 6, 201, "Kopieren")
Toolbar("AddButton", hToolbar2, 7, 202, "Einfügen")
Toolbar("AddButton", hToolbar2, 8, 203, "Löschen")
Var R# = New(RECT)
' Hauptprogrammschleife
Sinestar encargado %Umessage = ~wm_close
WaitInput
MPos
PosInWnd
if erg&=STB1&
SetWindowpos STB1&=links1&,oben1&-width(STB1&),height(STB1&);0
~EnumChildWindows(%hwnd,ProcAddr("MoveIt",2),MakeLong(%mousex,%mousey))
Case GetCheck(CB&)=1:UpdateToolbar 1,STB1&
endif
if erg&=STB2&
SetWindowpos STB2&=links2&,oben2&-width(STB2&),height(STB2&);0
~EnumChildWindows(%hwnd,ProcAddr("MoveIt",2),MakeLong(%mousex,%mousey))
Case GetCheck(CB&)=1:UpdateToolbar 2,STB2&
endif
EndWhile
'Ende
Disponer hdr#
Disponer R#
Disponer bereich#
Disponer objeto#
end