# Toolbar [v2.31]

作者: majkinetor 最近更新时间: nonexistent

The module is designed with following goals in mind :
* To allow programmers to quickly create toolbars in intuitive way.
* To allow advanced (non-typical) use, such as dynamic toolbar creation in such way that it doesn抰 complicate typical toolbar usage.
* To allow users to customize toolbar and programmer to save changed toolbar state.
* Not to have any side effects on your script.

Toolbar("oldNotify", RegisterCallback(old)
Toolbar_Add(hGui, Handler, Style="", ImageList="", Pos="")
Toolbar_add2Form(hParent, Txt, Opt)
Toolbar_AutoSize(hCtrl, Align="fit")
Toolbar_CheckButton(hCtrl, WhichButton, bCheck=1)
Toolbar_Clear(hCtrl)
Toolbar_CommandToIndex( hCtrl, ID )
Toolbar_compileButtons(hCtrl, Btns, ByRef cBTN)
Toolbar_Count(hCtrl, pQ="c")
Toolbar_Customize(hCtrl)
Toolbar_Define(hCtrl, pQ="")
Toolbar_DeleteButton(hCtrl, Pos=1)
Toolbar_GetButton(hCtrl, WhichButton, pQ="")
Toolbar_getButtonArray(hCtrl, ByRef cBtn)
Toolbar_GetButtonSize(hCtrl, ByRef W, ByRef H)
Toolbar_GetMaxSize(hCtrl, w, h)
Toolbar_GetRect(hCtrl, Pos="", pQ="")
Toolbar_getStateName( hState )
Toolbar_getStyleName( hStyle )
Toolbar_Insert(hCtrl, Btns, Pos="")
Toolbar_malloc(pSize)
Toolbar_memcpy( TBB, o, 20)
Toolbar_memmove( aBTN + 20*(Pos-1)
Toolbar_mfree( Toolbar( hCtrl "aBTN", "" )
Toolbar_MoveButton(hCtrl, Pos, NewPos)
Toolbar_onEndAdjust(hw, cBTN, cnt)
Toolbar_onNotify(Wparam,Lparam,Msg,Hwnd)
Toolbar_SetBitmapSize(hCtrl, Width=0, Height=0)
Toolbar_SetButton(hCtrl, WhichButton, State="", Width="")
Toolbar_SetButtonSize(hCtrl, W, H="")
Toolbar_SetButtonWidth(hCtrl, Min, Max="")
Toolbar_SetDrawTextFlags(hToolbar, 3, 2)
Toolbar_SetImageList(hCtrl, ImageList)
Toolbar_SetMaxTextRows(hCtrl, iMaxRows=0)
Toolbar_ToggleStyle(hCtrl, Style="LIST")

关于函数的参数和返回值, 请参阅其源码.

#### 备注

This module is part of the Forms Framework package.
See also original home:
* http://www.autohotkey.com/forum/topic27382.html
Parts of code in Toolbar_onNotify by jballi.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=53317

#### 许可

此函数(集)是基于 GNU GPL 许可的开源项目. 想了解许可详情, 请参见 gpl-2.0.txt

#### 示例

    ; #Include Toolbar.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

       Gui, +LastFound
       hGui := WinExist()
       Gui, Show , w500 h100 Hide                              ;set gui width & height prior to adding toolbar (mandatory)

       hCtrl := Toolbar_Add(hGui, "OnToolbar", "FLAT TOOLTIPS", "1L")    ;add the toolbar

       btns =
        (LTrim
           new,  7,            ,dropdown showtext
           open, 8
           save, 9, disabled
           -
           undo, 4,            ,dropdown
           redo, 5,            ,dropdown
           -----
           state, 11, checked  ,check
        )

        Toolbar_Insert(hCtrl, btns)
        Toolbar_SetButtonWidth(hCtrl, 50)                   ;set button width & height to 50 pixels

        Gui, Show
    return

    ;toolbar event handler
    OnToolbar(hCtrl, Event, Txt, Pos){
           tooltip %Event% %Txt% (%Pos%), 0, 0
    }

    GuiClose:
    ExitApp