summaryrefslogtreecommitdiff
path: root/include/delphi/m_toolbar.inc
blob: 75d291b073d7e72ea10e9dab63b9af82a6107db2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{$IFNDEF M_TOOLBAR}
{$DEFINE M_TOOLBAR}

// Modern contact list toolbar

const
  TOOLBARBUTTON_ICONIDPREFIX          = 'MTB_';
  TOOLBARBUTTON_ICONIDPRIMARYSUFFIX   = '_Primary';
  TOOLBARBUTTON_ICONIDSECONDARYSUFFIX = '_Secondary';
  TOOLBARBUTTON_ICONNAMEPRESSEDSUFFIX = 'Pressed';

//button flags
  TBBF_DISABLED    = 1 shl 0;
  TBBF_VISIBLE     = 1 shl 1;
  TBBF_PUSHED      = 1 shl 2;
  TBBF_SHOWTOOLTIP = 1 shl 3;
  TBBF_ISSEPARATOR = 1 shl 5;
  TBBF_ISLBUTTON   = 1 shl 6;
  TBBF_FLEXSIZESEPARATOR = TBBF_ISSEPARATOR or TBBF_PUSHED;

type
  _tagTBButton = record
    cbSize              :int;       // size of structure
    pszButtonID         :pAnsiChar; // char id of button used to store button info in DB and know about icon
    pszButtonName       :pAnsiChar; // name of button (not translated)
    pszServiceName      :pAnsiChar; // service name to be executed
    lParam              :LPARAM;    // param of service to be called
    pszTooltipUp        :pAnsiChar;
    pszTooltipDn        :pAnsiChar;
    defPos              :dword;     // default order pos of button (less values are nearer to
                                    // edge)..please use values greater that 100. the default
                                    // buttons has pos: 10,20..90
    tbbFlags            :dword;     // combine of TBBF_ flags above
    ParamDestructor     :procedure(var param); //will be called on parameters deletion
    hPrimaryIconHandle  :THANDLE;
    hSecondaryIconHandle:THANDLE;
  end;
  TBButton = _tagTBButton;

const
//////////////////////////////////////////////////////////////////////////
// Events
// Only after this event module subscribers should register their buttons
// wparam=lparam=0
// don't forget to return 0 to continue processing
  ME_TB_MODULELOADED:PAnsiChar = 'ToolBar/ModuleLoaded';

//////////////////////////////////////////////////////////////////////////
// Services
//
//////////////////////////////////////////////////////////////////////////
// Adding a button
// WPARAM  = 0
// LPARAM  = (TBButton *) &description
// LRESULT = (HANDLE) hButton
// in order to correctly process default icons via iconlib it should be
// registered icolib icon with id named:
// 'TBButton_'+pszButtonID+ 'Up' or +'Down' for Push (2-state) buttons
  MS_TB_ADDBUTTON:PAnsiChar = 'ToolBar/AddButton';

//////////////////////////////////////////////////////////////////////////
// Remove button
// WPARAM = (HANDLE) hButton;
// LPARAM = 0;
  MS_TB_REMOVEBUTTON:PAnsiChar = 'ToolBar/RemoveButton';

//////////////////////////////////////////////////////////////////////////
// SetState
// WPARAM = (HANDLE) hButton;
// LPARAM = one of below TBST_ states 
// LRESULT= old state
  TBST_PUSHED   = 1;
  TBST_RELEASED = 0;
  MS_TB_SETBUTTONSTATE:PAnsiChar = 'ToolBar/SetButtonState';

//////////////////////////////////////////////////////////////////////////
// SetStatebyId
// WPARAM = (char *) szButtonID;
// LPARAM = one of below TBST_ states 
// LRESULT= old state
  MS_TB_SETBUTTONSTATEBYID:PAnsiChar = 'ToolBar/SetButtonStateId';
//////////////////////////////////////////////////////////////////////////
// GetState
// WPARAM = (HANLDE) hButton;
// LPARAM = 0
// LRESULT= current state
  MS_TB_GETBUTTONSTATE:PAnsiChar = 'ToolBar/GetButtonState';

//////////////////////////////////////////////////////////////////////////
// GetState
// WPARAM = (char *) szButtonID;
// LPARAM = 0
// LRESULT= current state
  MS_TB_GETBUTTONSTATEBYID:PAnsiChar = 'ToolBar/GetButtonStateId';

{$ENDIF}