wxToolBox.h

00001 #ifndef _WX_TOOLBOX_H
00002 #define _WX_TOOLBOX_H
00003 
00004 #include <wx/wx.h>
00005 #include <wx/dynarray.h>
00006 #include <wx/timer.h>
00007 #include <wx/xml/xml.h>
00008 
00009 // ========================================================================
00010 //  wxScrollDirection
00011 // ------------------------------------------------------------------------
00013 enum wxScrollDirection
00014 {
00016         Left  = 3,
00018         Right = 4,
00020         Up    = 5,
00022         Down  = 6,
00023 };
00024 
00025 #define wxTB_TAB_LIST                   0
00026 #define wxTB_TAB_THUMBNAILS             1
00027 
00028 #define wxTB_STYLE_LIST                 wxTB_TAB_LIST
00029 #define wxTB_STYLE_THUMBNAILS   wxTB_TAB_THUMBNAILS
00030 
00031 class wxToolBoxTab;
00032 class wxToolBox;
00033 
00034 // ========================================================================
00035 //  wxToolObject
00036 // ------------------------------------------------------------------------
00038 class WXDLLEXPORT wxToolObject
00039 {
00040 protected:
00042         wxRect m_Rectangle;
00044         wxString m_ToolTip;
00045 public:
00047         wxToolObject();
00049 
00052         wxToolObject(wxRect r);
00054         wxToolObject(const wxToolObject & toolobject);
00056         void SetRectangle(wxRect value) {m_Rectangle = value;}
00058         wxRect & GetRectangle() {return m_Rectangle;}
00060 
00064         void SetSize(int w, int h) {m_Rectangle.SetWidth(w); m_Rectangle.SetHeight(h);}
00066         wxSize GetSize() {return wxSize(m_Rectangle.GetWidth(), m_Rectangle.GetHeight());}      
00068         void SetToolTip(wxString value) {m_ToolTip = value;}
00070         wxString GetToolTip() {return m_ToolTip;}
00071 };
00072 
00073 // ========================================================================
00074 //  wxToolBoxItem
00075 // ------------------------------------------------------------------------
00077 class WXDLLEXPORT wxToolBoxItem : public wxToolObject
00078 {
00079 protected:
00080         wxWindowID m_ID;
00082         wxToolBox * m_Parent;
00084         wxString m_Caption;
00086         int m_ImageIndex;
00088         bool m_Selected;
00090         bool m_Enabled;
00092         bool m_MouseDown;
00094         bool m_MouseHover;
00096         bool m_AllowDrag;
00098         bool m_IsDragging;
00100         bool m_Renamable;
00102         bool m_Movable;
00104         bool m_Deletable;
00105         //wxObject m_Object;
00106         wxToolBoxTab * m_ParentTab;
00107         wxRect m_DragSafeRect;
00108 public:
00110         wxToolBoxItem();
00111         virtual ~wxToolBoxItem() {}
00113 
00118         wxToolBoxItem(wxString caption, wxWindowID id = wxID_ANY, int imageindex = -1);
00120         wxToolBoxItem(const wxToolBoxItem & item);
00122         wxToolBoxItem operator = (wxToolBoxItem item);
00124 
00127         void SetID(wxWindowID value) {m_ID = value;}
00129         wxWindowID GetID() {return m_ID;}
00131 
00134         void SetParent(wxToolBox * parent) {m_Parent = parent;}
00136         wxToolBox * GetParent() {return m_Parent;}
00138 
00141         void SetCaption(wxString caption) {m_Caption = caption;}
00143         wxString GetCaption() {return m_Caption;}
00145 
00148         void SetImageIndex(int imageindex) {m_ImageIndex = imageindex;}
00150         int GetImageIndex() {return m_ImageIndex;}
00152 
00155         virtual void SetSelected(bool selected);
00157         bool GetSelected() {return m_Selected;}
00159 
00162         virtual void SetEnabled(bool enabled) {m_Enabled = enabled;}
00164         bool GetEnabled() {return m_Enabled;}
00166 
00169         void SetMouseDown(bool mousedown) {m_MouseDown = mousedown;}
00171         bool GetMouseDown() {return m_MouseDown;}
00173 
00176         void SetMouseHover(bool mousehover) {m_MouseHover = mousehover;}
00178         bool GetMouseHover() {return m_MouseHover;}
00180 
00183         void SetAllowDrag(bool allowdrag) {m_AllowDrag = allowdrag;}
00185         bool GetAllowDrag() {return m_AllowDrag;}
00187 
00190         void SetDragging(bool dragging) {m_IsDragging = dragging;}
00192         bool GetDragging() {return m_IsDragging;}
00194 
00197         void SetRenamable(bool renamable) {m_Renamable = renamable;}
00199         bool GetRenamable() {return m_Renamable;}
00201 
00204         void SetMovable(bool movable) {m_Movable = movable;}
00206         bool GetMovable() {return m_Movable;}
00208 
00211         void SetDeletable(bool deletable) {m_Deletable = deletable;}
00213         bool GetDeletable() {return m_Deletable;}
00214 
00215 /*      void SetObject(wxObject object) {m_Object = object;}
00216         wxObject GetObject() {return m_Object;}*/
00217 
00219 
00222         void SetParentTab(wxToolBoxTab * parenttab) {m_ParentTab = parenttab;}
00224         wxToolBoxTab * GetParentTab() {return m_ParentTab;}
00225 
00227         void SetMouseDownLocation(wxPoint pt)
00228         {
00229                 m_DragSafeRect.SetX(pt.x);
00230                 m_DragSafeRect.SetY(pt.y);              
00231                 m_DragSafeRect.SetSize(wxSize(wxSystemSettings::GetMetric(wxSYS_DRAG_X), 
00232                                                                           wxSystemSettings::GetMetric(wxSYS_DRAG_Y)));
00233                 m_DragSafeRect.Offset(-wxSystemSettings::GetMetric(wxSYS_DRAG_X)/2, 
00234                                                           -wxSystemSettings::GetMetric(wxSYS_DRAG_Y)/2);                
00235         }
00237         bool HitTest(wxPoint pt);       
00239         void CancelHover();
00241         void Rename();
00243         bool CanStartDrag(wxPoint pt);
00245         void Invalidate();
00246 };
00247 
00248 WX_DECLARE_OBJARRAY(wxToolBoxItem, wxToolBoxItemArray);
00249 
00250 // ========================================================================
00251 //  wxToolBoxTab
00252 // ------------------------------------------------------------------------
00254 class WXDLLEXPORT wxToolBoxTab : public wxToolBoxItem
00255 {       
00256 protected:
00258         wxRect m_ItemArea;              
00260         wxToolBoxItemArray m_ToolItems;
00262         int m_HotItemIndex;
00264         int m_SelItemIndex;
00266         int m_OldItemIndex;
00268         int m_NewItemIndex;
00270         int m_VisibleTopIndex;
00272         int m_VisibleBottomIndex;       
00274         int m_Style;
00276 
00280         void PaintItems(wxDC & dc, const wxRect & clipRect);
00282         void UpdateItemLoopIndexes();
00284 
00288         void UpdateItemLoopIndexes(int index, bool * bUpdates);
00290 
00293         void UpdateNewItem(unsigned int index);
00295         void ScrollItemsO(int offset);
00297         void ScrollItemsO(int offset, bool bRedraw);    
00298 public: 
00300 
00305         wxToolBoxTab(wxString caption = wxEmptyString, wxWindowID id = wxID_ANY, int imageindex = -1);
00307 
00311         bool SwapItems(unsigned int index1, unsigned int index2);
00313         wxToolBoxItemArray & GetToolItems() {return m_ToolItems;}
00315 
00318         void SetItemArea(wxRect itemarea) {m_ItemArea = itemarea;}
00320         wxRect GetItemArea() {return m_ItemArea;}
00322 
00325         void SetSelItemIndex(int selitemindex) {m_SelItemIndex = selitemindex;}
00327         int GetSelItemIndex() {return m_SelItemIndex;}
00329 
00332         virtual void SetSelected(bool selected);
00334 
00337         virtual void SetEnabled(bool enabled);
00339         size_t GetItemCount() {return m_ToolItems.Count();}
00340 
00342 
00345         wxToolBoxItem * operator [] (int index);        
00347 
00350         int HitTestItem(wxPoint pt);
00352 
00355         bool EnsureItemVisible(int index);
00357         void CancelHotItemHover();
00358 
00360         void CheckMouseMoveForItems(wxMouseEvent & event);
00362 
00365         bool ItemVisible(unsigned int index);
00367 
00370         bool ItemVisible(wxToolBoxItem * item);
00372 
00375         bool Contains(wxToolBoxItem * item);    
00377 
00380         bool CanScroll(wxScrollDirection scrollDir);
00382 
00385         bool CanMoveItemUp(wxToolBoxItem * item);
00387 
00390         bool CanMoveItemDown(wxToolBoxItem * item);
00392 
00395         bool MoveItemUp(wxToolBoxItem * item);
00397 
00400         bool MoveItemDown(wxToolBoxItem * item);
00402 
00405         int IndexOfItem(wxToolBoxItem * item);  
00407 
00410         bool DeleteItem(int index);
00412 
00415         bool DeleteItem(wxToolBoxItem * item);  
00417 
00420         bool ScrollItems(wxScrollDirection scrollDir);
00422 
00426         bool ScrollItems(wxScrollDirection scrollDir, bool bRedraw);
00427 
00428         void ScrollTo(unsigned int index);
00430 
00433         int AddItem(wxToolBoxItem item);
00434 
00436         void UpdateItemRects(bool bRedraw);
00438 
00443         void UpdateItemRects(bool bUpdateXY, bool bUpdateSize, bool bRedraw);
00444 
00446 
00453         void SetStyle(unsigned int value, bool bApply = true);
00455         unsigned int GetStyle();
00456 
00457         void OnMouseDown(wxMouseEvent & event);
00458         void OnMouseUp(wxMouseEvent & event);   
00459         void OnMouseMove(wxMouseEvent & event);
00460         void OnPaint(wxDC & dc, wxRect r);
00461         bool bDebug;
00462         void DebugItems();
00463 };
00464 
00465 WX_DECLARE_LIST(wxToolBoxTab, wxToolBoxTabList);
00466 
00467 // ========================================================================
00468 //  wxToolItemEditorTextCtrl
00469 // ------------------------------------------------------------------------
00471 class WXDLLEXPORT wxToolItemEditorTextCtrl : public wxTextCtrl
00472 {
00474         wxToolBoxItem * m_Item;
00475 public:
00477 
00484         wxToolItemEditorTextCtrl(wxToolBox * parent, wxToolBoxItem * item = NULL, wxPoint pos = wxDefaultPosition,
00485                 wxSize size = wxDefaultSize, long style = wxSIMPLE_BORDER);
00487 
00490         void SetItem(wxToolBoxItem * item) {m_Item = item;}
00492         wxToolBoxItem * GetItem() {return m_Item;}
00493         DECLARE_EVENT_TABLE()
00494         void OnEnterKeyPressed(wxCommandEvent & event);
00495 };
00496 
00497 // ========================================================================
00498 //  wxToolBoxScrollButton
00499 // ------------------------------------------------------------------------
00501 class WXDLLEXPORT wxToolBoxScrollButton : public wxToolObject
00502 {
00504         bool m_MouseDown;
00506         bool m_MouseHover;
00508         bool m_Enabled;
00510         wxScrollDirection m_Direction;
00512         wxToolBox * m_Parent;
00513 public: 
00515 
00520         wxToolBoxScrollButton(wxToolBox * parent, wxScrollDirection dir, wxSize size);
00521 
00526         void SetMouseDown(bool value) {m_MouseDown = value;}
00528         bool GetMouseDown() {return m_MouseDown;}
00533         void SetMouseHover(bool value) {m_MouseHover = value;}
00535         bool GetMouseHover() {return m_MouseHover;}
00540         void SetEnabled(bool value) {m_Enabled = value;}
00542         bool GetEnabled() {return m_Enabled;}
00544 
00547         void SetX(int x) {m_Rectangle.SetX(x);}
00549 
00552         void SetY(int y) {m_Rectangle.SetY(y);}
00557         void SetScrollDirection(wxScrollDirection value) {m_Direction = value;}
00559         wxScrollDirection GetSrollDirection() {return m_Direction;}     
00565         void Paint(wxDC & dc, const wxRect & clipRect); 
00571         bool HitTest(wxCoord x, wxCoord y);
00573         void Invalidate();
00574 };
00575 
00576 // ========================================================================
00577 //  wxToolBoxBitmapSet
00578 // ------------------------------------------------------------------------
00580 class WXDLLEXPORT wxToolBoxBitmapSet
00581 {
00582 protected:
00584         wxString m_LeftPath;
00586         wxString m_MiddlePath;
00588         wxString m_RightPath;
00590         wxBitmap m_LeftBitmap;
00592         wxBitmap m_MiddleBitmap;
00594         wxBitmap m_RightBitmap;
00595 public:
00597         wxToolBoxBitmapSet() {}
00599 
00604         wxToolBoxBitmapSet(wxString left, wxString middle, wxString right);
00606         wxToolBoxBitmapSet(const wxToolBoxBitmapSet & bmpset);
00608 
00611         void SetLeftBitmap(wxString bitmap);
00613         wxBitmap & GetLeftBitmap() {return m_LeftBitmap;}
00615         wxString GetLeftPath() {return m_LeftPath;}
00617 
00620         void SetMiddleBitmap(wxString bitmap);
00622         wxBitmap & GetMiddleBitmap() {return m_MiddleBitmap;}
00624         wxString GetMiddlePath() {return m_MiddlePath;}
00626 
00629         void SetRightBitmap(wxString bitmap);
00631         wxBitmap & GetRightBitmap() {return m_RightBitmap;}
00633         wxString GetRightPath() {return m_RightPath;}
00635         wxToolBoxBitmapSet operator = (const wxToolBoxBitmapSet bmpset);
00637         unsigned int GetMaxBitmapHeight();
00638 };
00639 
00640 // ========================================================================
00641 //  wxToolObjectBackground
00642 // ------------------------------------------------------------------------
00644 class WXDLLEXPORT wxToolObjectBackground
00645 {
00647         wxToolBoxBitmapSet m_NormalBackground;
00649         wxToolBoxBitmapSet m_HoverBackground;
00651         wxToolBoxBitmapSet m_SelectedBackground;
00652 public:
00654         wxToolObjectBackground() {}
00656 
00661         wxToolObjectBackground(wxToolBoxBitmapSet & normal, wxToolBoxBitmapSet & hover, wxToolBoxBitmapSet & selected);
00663 
00666         void SetNormalBackground(wxToolBoxBitmapSet & background) {m_NormalBackground = background;}
00668         wxToolBoxBitmapSet & GetNormalBackground() {return m_NormalBackground;}
00670 
00673         void SetHoverBackground(wxToolBoxBitmapSet & background) {m_HoverBackground = background;}
00675         wxToolBoxBitmapSet & GetHoverBackground() {return m_HoverBackground;}
00677 
00680         void SetSelectedBackground(wxToolBoxBitmapSet & background) {m_SelectedBackground = background;}
00682         wxToolBoxBitmapSet & GetSelectedBackground() {return m_SelectedBackground;}
00684         unsigned int GetMaxBitmapHeight();
00685 
00686 };
00687 
00688 WX_DECLARE_OBJARRAY(wxBitmap, wxToolBoxIconArray);
00689 
00690 // ========================================================================
00691 //  wxToolBox
00692 // ------------------------------------------------------------------------
00695 class WXDLLEXPORT wxToolBox : public wxControl
00696 {               
00697         void LoadToolItemParameters(wxToolBoxItem * item, wxXmlNode * node);
00698         void SaveToolItemParameters(wxToolBoxItem * item, wxXmlNode * node);
00699         DECLARE_DYNAMIC_CLASS(wxToolBox)
00700         int m_Style;
00701 protected:      
00702         wxBitmap m_CanvasBitmap;
00703         //wxMemoryDC mdc;
00705         wxToolBoxTabList m_Tabs;
00706 
00708         wxToolBoxTab * m_SelectedTab;
00710         wxToolBoxTab * m_OldSelectedTab;
00711 
00713         wxString m_TabImageListBitmapPath;
00715         wxString m_ItemImageListBitmapPath;
00717         wxToolBoxIconArray m_TabImageList;
00719         wxToolBoxIconArray m_ItemImageList;
00720 
00722         wxColour m_ItemNormalColour;
00724         wxColour m_ItemHoverColour;
00726         wxColour m_ItemSelectedColour;
00727 
00729         wxColour m_TabNormalColour;
00731         wxColour m_TabHoverColour;
00733         wxColour m_TabSelectedColour;
00734 
00736         wxColour m_ButtonNormalColour;
00738         wxColour m_ButtonHoverColour;
00740         wxColour m_ButtonSelectedColour;
00741 
00743         unsigned int m_TabImageWidth;
00745         unsigned int m_TabImageHeight;
00746 
00748         unsigned int m_ItemImageWidth;
00750         unsigned int m_ItemImageHeight;
00751 
00753         unsigned int m_TabHeight;
00755         unsigned int m_ItemHeight;
00756 
00758         unsigned int m_TabSpacing;
00760         unsigned int m_ItemSpacing;
00761 
00763         unsigned int m_TabCaptionSpacing;
00765         unsigned int m_ItemCaptionSpacing;
00766 
00767         unsigned int m_ScrollWait;
00768         unsigned int m_ScrollDelay;
00769         
00771         wxToolItemEditorTextCtrl * m_TextBox;
00773         wxToolBoxScrollButton *m_UpScroll;
00775         wxToolBoxScrollButton * m_DownScroll;
00776         
00778         bool m_UseBackground;
00780         wxBitmap m_ToolBoxBackground;
00782         wxString m_ToolBoxBackgroundPath;
00784         bool m_UseTabBackground;
00786         wxToolObjectBackground m_TabBackground;
00788         bool m_UseItemNormalBackground;
00790         bool m_UseItemHoverBackground;
00792         bool m_UseItemSelectedBackground;
00794         wxToolObjectBackground m_ItemBackground;
00796         bool m_UseButtonBackground;
00798         bool m_UseStdArrows;
00800         wxToolObjectBackground m_ButtonBackground;
00801         
00803         bool m_ItemsTransparent;
00805         bool m_SelectedItemTransparent;
00806 
00807         wxFont m_TabNormalFont;
00808         wxFont m_TabHoverFont;
00809         wxFont m_TabSelectedFont;
00810         
00811         wxFont m_ItemNormalFont;
00812         wxFont m_ItemHoverFont;
00813         wxFont m_ItemSelectedFont;
00814         
00815         wxColour m_ItemTextColour;
00816         wxColour m_TabTextColour;
00817 
00818         bool m_MouseMoveFreezed;
00819         bool m_LayoutTimerActive;
00820 
00821         bool m_SelectNewTab;
00822         bool m_ShowSelectionAlways;
00823 
00825         bool m_PreDrawBackgrounds;
00826         
00827         wxTimer * m_LayoutTimer;
00828 
00829         bool OnRenameFinished(bool bCancelled);
00830         void UpdateItemFromTextBox();
00832         void DoLayout(bool bInitial, bool bUpdateItems, bool bRepaint);
00833         bool DoTimedLayout(wxToolBoxTab * oldSelectedTab);
00834 
00835         wxBitmap m_TabNormalBG;
00836         wxBitmap m_TabHoverBG;
00837         wxBitmap m_TabSelectedBG;
00838         wxBitmap m_TabNormalBGSel;
00839         wxBitmap m_TabHoverBGSel;
00840         wxBitmap m_TabSelectedBGSel;
00841         
00842         wxBitmap m_ItemNormalBG;
00843         wxBitmap m_ItemHoverBG;
00844         wxBitmap m_ItemSelectedBG;      
00845 
00847         wxPen m_BorderHighlightPen;
00849         wxPen m_BorderShadowPen;
00850 
00851         void PreDrawBackgrounds();
00852         void PreDrawItemBackground();
00853         void DrawBG(wxDC & dc, wxBitmap * left_bmp, wxBitmap * middle_bmp, wxBitmap * right_bmp,
00854                 int left, int top);
00855 
00857 
00864         void CreateImageListFromBitmap(wxToolBoxIconArray & image_list, wxBitmap & bmp, 
00865                 int width, int height, bool clear_existing = false);
00866 public:
00868         wxToolBox() {};
00870 
00877         wxToolBox(wxWindow * parent, wxWindowID id = -1, wxPoint pos = wxDefaultPosition, 
00878                 wxSize size = wxDefaultSize, long style = 0);
00880         ~wxToolBox();
00881 
00883         wxToolBoxTabList & GetTabs() {return m_Tabs;}
00884 
00886         wxToolBoxTab * GetTab(unsigned int index) {return (*this)[index];}
00887 
00889         unsigned int GetTabCount() {return (unsigned int)m_Tabs.GetCount();}    
00890 
00892         wxToolBoxIconArray & GetTabImageList() {return m_TabImageList;}
00894         wxToolBoxIconArray & GetItemImageList() {return m_ItemImageList;}
00896         wxToolBoxTab * GetSelectedTab() {return m_SelectedTab;}
00897 
00899 
00902         void SetItemNormalColour(wxColour value) {m_ItemNormalColour = value; Refresh();}
00904         const wxColour & GetItemNormalColour() {return m_ItemNormalColour;}
00906 
00909         void SetItemHoverColour(wxColour value) {m_ItemHoverColour = value; Refresh();}
00911         const wxColour & GetItemHoverColour() {return m_ItemHoverColour;}
00913 
00916         void SetItemSelectedColour(wxColour value) {m_ItemSelectedColour = value; Refresh();}
00918         const wxColour & GetItemSelectedColour() {return m_ItemSelectedColour;}
00919 
00921 
00924         void SetTabNormalColour(wxColour value) {m_TabNormalColour = value; Refresh();}
00926         const wxColour & GetTabNormalColour() {return m_TabNormalColour;}
00928 
00931         void SetTabHoverColour(wxColour value) {m_TabHoverColour = value; Refresh();}
00933         const wxColour & GetTabHoverColour() {return m_TabHoverColour;}
00935 
00938         void SetTabSelectedColour(wxColour value) {m_TabSelectedColour = value; Refresh();}
00940         const wxColour & GetTabSelectedColour() {return m_TabSelectedColour;}
00941 
00943 
00946         void SetButtonNormalColour(wxColour value) {m_ButtonNormalColour = value; Refresh();}
00948         const wxColour & GetButtonNormalColour() {return m_ButtonNormalColour;}
00950 
00953         void SetButtonHoverColour(wxColour value) {m_ButtonHoverColour = value; Refresh();}
00955         const wxColour & GetButtonHoverColour() {return m_ButtonHoverColour;}
00957 
00960         void SetButtonSelectedColour(wxColour value) {m_ButtonSelectedColour = value; Refresh();}
00962         const wxColour & GetButtonSelectedColour() {return m_ButtonSelectedColour;}
00963 
00964 
00966 
00969         void SetTabImageWidth(unsigned int value) {m_TabImageWidth = value;}    
00971         unsigned int GetTabImageWidth() {return m_TabImageWidth;}
00972 
00974 
00977         void SetTabImageHeight(unsigned int value) {m_TabImageHeight = value;}
00979         unsigned int GetTabImageHeight() {return m_TabImageHeight;}
00980 
00981 
00983 
00986         void SetItemImageWidth(unsigned int value) {m_ItemImageWidth = value;}  
00988         unsigned int GetItemImageWidth() {return m_ItemImageWidth;}
00989 
00991 
00994         void SetItemImageHeight(unsigned int value) {m_ItemImageHeight = value;}
00996         unsigned int GetItemImageHeight() {return m_ItemImageHeight;}
00997 
00999 
01002         void SetTabHeight(unsigned int value) {m_TabHeight = value; DoLayout(false, false, false); Refresh();}
01004         unsigned int GetTabHeight() {return m_TabHeight;}
01005 
01007 
01010         void SetItemHeight(unsigned int value) {m_ItemHeight = value; DoLayout(false, true, false); Refresh();}
01012         unsigned int GetItemHeight() {return m_ItemHeight;}
01013 
01015 
01018         void SetTabSpacing(unsigned int value) {m_TabSpacing = value; DoLayout(false, false, false); Refresh();}
01020         unsigned int GetTabSpacing() {return m_TabSpacing;}
01021 
01023 
01026         void SetItemSpacing(unsigned int value) {m_ItemSpacing = value; DoLayout(false, true, false); Refresh();}
01028         unsigned int GetItemSpacing() {return m_ItemSpacing;}
01029 
01031 
01034         void SetTabCaptionSpacing(unsigned int value) {m_TabCaptionSpacing = value; Refresh();}
01036         unsigned int GetTabCaptionSpacing() {return m_TabCaptionSpacing;}
01037 
01039 
01042         void SetItemCaptionSpacing(unsigned int value) {m_ItemCaptionSpacing = value; Refresh();}
01044         unsigned int GetItemCaptionSpacing() {return m_ItemCaptionSpacing;}
01045 
01046         void SetScrollWait(unsigned int value) {m_ScrollWait = value;}
01047         unsigned int GetScrollWait() {return m_ScrollWait;}
01048 
01049         void SetScrollDelay(unsigned int value) {m_ScrollDelay = value;}
01050         unsigned int GetScrollDelay() {return m_ScrollDelay;}
01051 
01053 
01058         void DrawBorders(wxDC & dc, const wxRect & rect, bool bSelected);
01059 
01061         wxToolBoxItem * GetEditingItem();
01062 
01064         wxToolBoxScrollButton * GetUpScroll() {return m_UpScroll;}
01066         wxToolBoxScrollButton * GetDownScroll() {return m_DownScroll;}
01067 
01068         bool EndRenameItem(bool bSave);
01070         void RefreshTabs();
01071 
01073 
01076         int AddTab(wxToolBoxTab * tab);
01078 
01081         bool DeleteTab(int index);
01083 
01086         bool DeleteTab(wxToolBoxTab * tab) {return DeleteTab(IndexOf(tab));}
01087 
01089 
01092         void UpdateToolTip(wxToolObject * item);
01093         void OnTabSelectionChanged(wxToolBoxTab * newtab, wxToolBoxTab * oldtab);
01094         void OnItemSelectionChanged(wxToolBoxItem * item, wxToolBoxTab * tab) {}
01095         void OnTabMouseDown(wxToolBoxTab * tab, wxMouseEvent & event);
01096         void OnTabMouseUp(wxToolBoxTab * tab, wxMouseEvent & event) {}
01097         void OnItemMouseUp(wxToolBoxItem * item, wxToolBoxTab * tab, wxMouseEvent & event) {}
01098         void LockMouseMove() {m_MouseMoveFreezed = true;}
01099         void UnlockMouseMove() {m_MouseMoveFreezed = false;}
01100 
01102 
01108         void CreateTabImageList(wxString filename, int image_width, int image_height, bool clear_existing = false);
01110         const wxString & GetTabImageListBitmapPath() {return m_TabImageListBitmapPath;} 
01111 
01113 
01119         void CreateItemImageList(wxString filename, int image_width, int image_height, bool clear_existing = false);
01121         const wxString & GetItemImageListBitmapPath() {return m_ItemImageListBitmapPath;}       
01122 
01124 
01127         void SetBackground(wxString background);
01129         const wxBitmap & GetBackground();
01131         wxString GetBackgroundPath() {return m_ToolBoxBackgroundPath;};
01132 
01134 
01137         void SetUseBackground(bool value) {m_UseBackground = value; Refresh();}
01139         bool GetUseBackground() {return m_UseBackground;}
01140 
01142 
01147         void SetItemBackground(wxToolBoxBitmapSet & normal, wxToolBoxBitmapSet & hover, wxToolBoxBitmapSet & selected);
01149         wxToolObjectBackground & GetItemBackground() {return m_ItemBackground;}
01151 
01154         void SetNormalItemBackground(wxToolBoxBitmapSet & background);
01156 
01159         void SetHoverItemBackground(wxToolBoxBitmapSet & background);
01161 
01164         void SetSelectedlItemBackground(wxToolBoxBitmapSet & background);
01166 
01169         void SetUseItemNormalBackground(bool value) {m_UseItemNormalBackground = value; Refresh();}
01171         bool GetUseItemNormalBackground() {return m_UseItemNormalBackground;}
01173 
01176         void SetUseItemHoverBackground(bool value) {m_UseItemHoverBackground = value; Refresh();}
01178         bool GetUseItemHoverBackground() {return m_UseItemHoverBackground;}
01180 
01183         void SetUseItemSelectedBackground(bool value) {m_UseItemSelectedBackground = value; Refresh();}
01185         bool GetUseItemSelectedBackground() {return m_UseItemSelectedBackground;}
01187 
01190         void SetUseItemBackground(bool value);
01191 
01193 
01198         void SetTabBackground(wxToolBoxBitmapSet & normal, wxToolBoxBitmapSet & hover, wxToolBoxBitmapSet & selected);
01200         wxToolObjectBackground & GetTabBackground() {return m_TabBackground;}
01202 
01205         void SetNormalTabBackground(wxToolBoxBitmapSet & background);
01207 
01210         void SetHoverTabBackground(wxToolBoxBitmapSet & background);
01212 
01215         void SetSelectedlTabBackground(wxToolBoxBitmapSet & background);
01217 
01220         void SetUseTabBackground(bool value) {m_UseTabBackground = value; Refresh();}
01222         bool GetUseTabBackground() {return m_UseTabBackground;}
01223 
01225 
01230         void SetButtonBackground(wxToolBoxBitmapSet & normal, wxToolBoxBitmapSet & hover, wxToolBoxBitmapSet & selected);
01232         wxToolObjectBackground & GetButtonBackground() {return m_ButtonBackground;}
01234 
01237         void SetNormalButtonBackground(wxToolBoxBitmapSet & background);
01239 
01242         void SetHoverButtonBackground(wxToolBoxBitmapSet & background);
01244 
01247         void SetSelectedlButtonBackground(wxToolBoxBitmapSet & background);
01249 
01252         void SetUseButtonBackground(bool value) {m_UseButtonBackground = value; Refresh();}
01254         bool GetUseButtonBackground() {return m_UseButtonBackground;}
01256 
01259         void SetUseStdArrows(bool value) {m_UseStdArrows = value; Refresh();}
01261         bool GetUseStdArrows() {return m_UseStdArrows;}
01262 
01264 
01267         void SetItemsTransparent(bool value) {m_ItemsTransparent = value; Refresh();}
01269         bool GetItemsTransparent() {return m_ItemsTransparent;}
01271 
01274         void SetSelectedItemTransparent(bool value) {m_SelectedItemTransparent = value; Refresh();}
01276         bool GetSelectedItemTransparent() {return m_SelectedItemTransparent;}
01277 
01279 
01282         void SetItemTextColour(wxColour value) {m_ItemTextColour = value; Refresh();}
01284         const wxColour & GetItemTextColour() {return m_ItemTextColour;}
01285 
01287 
01290         void SetTabTextColour(wxColour value) {m_TabTextColour = value; Refresh();}
01292         const wxColour & GetTabTextColour() {return m_TabTextColour;}
01293 
01295 
01298         void SetItemNormalFont(wxFont & font) {m_ItemNormalFont = font; Refresh();};
01300         const wxFont & GetItemNormalFont() {return m_ItemNormalFont;}
01302 
01305         void SetItemHoverFont(wxFont & font) {m_ItemHoverFont = font; Refresh();};
01307         const wxFont & GetItemHoverFont() {return m_ItemHoverFont;}
01309 
01312         void SetItemSelectedFont(wxFont & font) {m_ItemSelectedFont = font; Refresh();};
01314         const wxFont & GetItemSelectedFont() {return m_ItemSelectedFont;}
01315 
01317 
01320         void SetTabNormalFont(wxFont & font) {m_TabNormalFont = font; Refresh();};
01322         const wxFont & GetTabNormalFont() {return m_TabNormalFont;}
01324 
01326         void SetTabHoverFont(wxFont & font) {m_TabHoverFont = font; Refresh();};
01328         const wxFont & GetTabHoverFont() {return m_TabHoverFont;}
01330 
01333         void SetTabSelectedFont(wxFont & font) {m_TabSelectedFont = font; Refresh();};
01335         const wxFont & GetTabSelectedFont() {return m_TabSelectedFont;}
01336 
01338 
01345         void SetPreDrawBackgrounds(bool value);
01347         bool GetPreDrawBackgrounds() {return m_PreDrawBackgrounds;}
01348 
01350 
01353         void SetSelectNewTab(bool value) {m_SelectNewTab = value;}
01355         bool GetSelectNewTab() {return m_SelectNewTab;}
01356 
01358 
01361         void SetShowSelectionAlways(bool value) {m_ShowSelectionAlways = value;}
01363         bool GetShowSelectionAlways() {return m_ShowSelectionAlways;}
01364 
01366 
01369         void SetBorderHighlightColour(wxColour & colour) {m_BorderHighlightPen = wxPen(colour, 1, wxSOLID);}
01371         wxColour & GetBorderHighlightColour() {return m_BorderHighlightPen.GetColour();}
01373         const wxPen & GetBorderHighlightPen() {return m_BorderHighlightPen;}
01375 
01378         void SetBorderShadowColour(wxColour & colour) {m_BorderShadowPen = wxPen(colour, 1, wxSOLID);}
01380         wxColour & GetBorderShadowColour() {return m_BorderShadowPen.GetColour();}
01382         const wxPen & GetBorderShadowPen() {return m_BorderShadowPen;}
01383 
01385         wxBitmap & GetTabNormalBGPre() {return m_TabNormalBG;}
01387         wxBitmap & GetTabHoverBGPre() {return m_TabHoverBG;}
01389         wxBitmap & GetTabSelectedBGPre() {return m_TabSelectedBG;}
01391         wxBitmap & GetTabNormalBGSelPre() {return m_TabNormalBGSel;}
01393         wxBitmap & GetTabHoverBGSelPre() {return m_TabHoverBGSel;}
01395         wxBitmap & GetTabSelectedBGSelPre() {return m_TabSelectedBGSel;}
01397         wxBitmap & GetItemNormalBGPre() {return m_ItemNormalBG;}
01399         wxBitmap & GetItemHoverBGPre() {return m_ItemHoverBG;}
01401         wxBitmap & GetItemSelectedBGPre() {return m_ItemSelectedBG;}
01402 
01404 
01408         bool SwapTabs(int index1, int index2);
01410 
01414         bool SwapTabs(wxToolBoxTab * tab1, wxToolBoxTab * tab2);
01416 
01419         int IndexOf(wxToolBoxTab * tab);
01420 
01422 
01425         void UseSkin(bool use_skin);
01426 
01428 
01431         bool LoadSkin(wxString path_to_skin);
01433 
01436         bool SaveSkin(wxString path_to_skin);
01437 
01439 
01442         wxToolBoxTab * operator [] (int index);
01443 
01445 
01448         void RenameItem(wxToolBoxItem * item);
01449 
01451 
01454         void SetStyle(unsigned int value);
01456         unsigned int GetStyle() {return m_Style;}
01457 
01459 
01462         bool LoadStructure(wxString path_to_structure);
01464 
01467         bool SaveStructure(wxString path_to_structure);
01468 
01469         DECLARE_EVENT_TABLE()
01470 
01471         void OnPaint(wxPaintEvent & event);
01472         void OnEraseBackground(wxEraseEvent & event);
01473         void OnSize(wxSizeEvent & event);
01474         void OnTimer(wxTimerEvent & event);
01475         void OnContextMenu(wxContextMenuEvent & event);
01476         void OnMouseDown(wxMouseEvent & event);
01477         void OnMouseUp(wxMouseEvent & event);
01478         void OnMouseWheel(wxMouseEvent & event);
01479         void OnMouseMove(wxMouseEvent & event);
01480         void OnMouseLeave(wxMouseEvent & event);
01481         void OnTimer_LayoutElapsed(wxTimerEvent & event);
01482 #ifdef __WXGTK__
01483         void OnWindowCreate(wxWindowCreateEvent & event);
01484 #endif
01485 public: 
01486 };
01487 
01488 bool CoordInRange(int coord, int mincoord, int maxcoord);
01489 
01491 
01494 wxBitmap GetStandardToolBoxArrow(wxScrollDirection dir);
01495 
01496 // ========================================================================
01497 //  wxToolBoxEvent
01498 // ------------------------------------------------------------------------
01549 class WXDLLEXPORT wxToolBoxEvent : public wxCommandEvent
01550 {
01551         wxToolBoxTab * m_Tab;
01552         wxToolBoxItem * m_Item;
01553         int m_ToolObjectIndex1;
01554         int m_ToolObjectIndex2;
01555         DECLARE_DYNAMIC_CLASS(wxToolBoxEvent)
01556 public:
01558 
01562         wxToolBoxEvent(wxEventType commandType=0, int id=0);
01563         wxToolBoxEvent(const wxToolBoxEvent & evt);
01565         wxEvent * Clone(void) const { return new wxToolBoxEvent(*this); }
01567 
01570         void SetTab(wxToolBoxTab * tab) {m_Tab = tab;}
01572         wxToolBoxTab * GetTab() {return m_Tab;}
01574 
01577         void SetItem(wxToolBoxItem * item) {m_Item = item;}
01579         wxToolBoxItem * GetItem() {return m_Item;}
01585         void SetToolObjectIndex(int value) {m_ToolObjectIndex1 = value;}
01587         int GetToolObjectIndex() {return m_ToolObjectIndex1;}
01593         void SetToolObjectIndex1(int value) {m_ToolObjectIndex1 = value;}
01595         int GetToolObjectIndex1() {return m_ToolObjectIndex1;}
01601         void SetToolObjectIndex2(int value) {m_ToolObjectIndex2 = value;}
01603         int GetToolObjectIndex2() {return m_ToolObjectIndex2;}
01604 };
01605 
01606 BEGIN_DECLARE_EVENT_TYPES()
01607     DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_TAB_ADDED, 13666)
01608         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_TAB_SELECTED, 13667)
01609         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_TAB_DELETED, 13678)   
01610         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_TABS_SWAPPED, 13669)
01612         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_TAB_MOVED, 13670)
01613 
01614         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_ITEM_ADDED, 13671)
01615         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_ITEM_SELECTED, 13672)
01616         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_ITEM_DELETED, 13673)          
01617         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_ITEMS_SWAPPED, 13674)
01619         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_ITEM_MOVED, 13675)
01620 
01621         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_SKIN_LOADED, 13676)
01622         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_SKIN_SAVED, 13677)
01623 
01624         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_STRUCTURE_LOADED, 13678)
01625         DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_TB_STRUCTURE_SAVED, 13679)
01626 END_DECLARE_EVENT_TYPES()
01627 
01628 typedef void (wxEvtHandler::*wxToolBoxEventFunction)(wxToolBoxEvent & event);
01629 
01630 #define EVT_TB_TAB_ADDED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_TAB_ADDED,          id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01631 #define EVT_TB_TAB_SELECTED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_TAB_SELECTED,       id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01632 #define EVT_TB_TAB_DELETED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_TAB_DELETED,        id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01633 #define EVT_TB_TABS_SWAPPED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_TABS_SWAPPED,       id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01635 #define EVT_TB_TAB_MOVED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_TAB_MOVED,          id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01636 
01637 #define EVT_TB_ITEM_ADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_ITEM_ADDED,         id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01638 #define EVT_TB_ITEM_SELECTED(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_ITEM_SELECTED,      id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01639 #define EVT_TB_ITEM_DELETED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_ITEM_DELETED,       id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01640 #define EVT_TB_ITEMS_SWAPPED(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_ITEMS_SWAPPED,      id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01642 #define EVT_TB_ITEM_MOVED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_ITEM_MOVED,         id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01643 
01644 #define EVT_TB_SKIN_LOADED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_SKIN_LOADED,        id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01645 #define EVT_TB_SKIN_SAVED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_SKIN_SAVED,         id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01646 
01647 #define EVT_TB_STRUCTURE_LOADED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_STRUCTURE_LOADED,   id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01648 #define EVT_TB_STRUCTURE_SAVED(id, fn)          DECLARE_EVENT_TABLE_ENTRY( wxEVT_TB_STRUCTURE_SAVED,    id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxToolBoxEventFunction, & fn ), (wxObject *) NULL ),
01649 
01650 #endif

Generated on Wed Apr 4 01:32:05 2007 for wxToolBox by  doxygen 1.5.1-p1