merge the formfield patch from ooo-build
[ooovba.git] / svx / source / tbxctrls / toolbarmenu.hxx
blob5b152fe4c6a951b6028eeeb35826afed7f8263e6
1 #include <vcl/ctrl.hxx>
3 #include <vector>
5 class ToolbarMenuEntry;
6 typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector;
8 class ToolbarMenu : public Control
10 private:
11 ToolbarMenuEntryVector maEntryVector;
13 int mnCheckPos;
14 int mnImagePos;
15 int mnTextPos;
17 int mnHighlightedEntry;
18 int mnSelectedEntry;
20 Size maSize;
22 Link maHighlightHdl;
23 Link maSelectHdl;
25 void StateChanged( StateChangedType nType );
26 void DataChanged( const DataChangedEvent& rDCEvt );
28 void initWindow();
30 Size implCalcSize();
32 void appendEntry( ToolbarMenuEntry* pEntry );
34 void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false );
36 void implHighlightEntry( int nHighlightEntry, bool bHighlight );
37 void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown );
39 void implChangeHighlightEntry( int nEntry );
40 void implSelectEntry( int nSelectedEntry );
42 ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd );
43 ToolbarMenuEntry* implGetEntry( int nEntry ) const;
44 ToolbarMenuEntry* implSearchEntry( int nEntryId ) const;
46 public:
47 ToolbarMenu( Window* pParent, WinBits nStyle );
48 ~ToolbarMenu();
50 virtual void MouseMove( const MouseEvent& rMEvt );
51 virtual void MouseButtonDown( const MouseEvent& rMEvt );
52 virtual void MouseButtonUp( const MouseEvent& rMEvt );
53 virtual void KeyInput( const KeyEvent& rKEvent );
54 virtual void Command( const CommandEvent& rCEvt );
55 virtual void Paint( const Rectangle& rRect );
56 virtual void RequestHelp( const HelpEvent& rHEvt );
57 virtual void Resize();
58 virtual void GetFocus();
59 virtual void LoseFocus();
61 void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 );
62 void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 );
63 void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 );
64 void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 );
65 void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 );
66 void appendSeparator();
68 void checkEntry( int nEntryId, bool bCheck = true );
69 bool isEntryChecked( int nEntryId ) const;
71 void enableEntry( int nEntryId, bool bEnable = true );
72 bool isEntryEnabled( int nEntryId ) const;
74 void setEntryText( int nEntryId, const String& rStr );
75 const String& getEntryText( int nEntryId ) const;
77 void setEntryImage( int nEntryId, const Image& rImage );
78 const Image& getEntryImage( int nEntryId ) const;
80 const Size& getMenuSize() const { return maSize; }
82 void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
83 const Link& GetHighlightHdl() const { return maHighlightHdl; }
85 void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
86 const Link& GetSelectHdl() const { return maSelectHdl; }
88 int getSelectedEntryId() const;
89 int getHighlightedEntryId() const;