root/BF_GUI_DlgViews_Menu.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __BF_GUI_TOOLS_MENU_H__
   2 #define __BF_GUI_TOOLS_MENU_H__
   3 
   4 #include "BF_GUI_DlgViews.h"
   5 
   6 
   7 enum{
   8         BF_GUI_TOOLMENU_MOVE_UP=0,
   9         BF_GUI_TOOLMENU_MOVE_DOWN,
  10         BF_GUI_TOOLMENU_MOVE_POS,
  11         BF_GUI_TOOLMENU_MOVE_END,
  12         BF_GUI_TOOLMENU_MOVE_PG_UP,     
  13         BF_GUI_TOOLMENU_MOVE_PG_DOWN
  14 };
  15 
  16 class BF_GUI_DlgView_Menu;
  17 
  18 class BF_GUI_ViewMenu_Item:public BL_Object{
  19 public:
  20                 BL_String                               sTitle,sCode;
  21                 float                                   fWidth;         
  22                 BBitmap                                 *poSIcon;
  23                 BL_List                                 loColItem;
  24                 bool                                    bSelected;
  25                 
  26                                                                 BF_GUI_ViewMenu_Item(const char *pc_Title,
  27                                                                                                         const char *pc_Code,                                                                                                    
  28                                                                                                         BBitmap *po_SIcon=NULL); // will be deleted
  29                                                                 BF_GUI_ViewMenu_Item(BF_GUI_ViewMenu_Item *po_Src);
  30                                                                 ~BF_GUI_ViewMenu_Item();
  31                                                                 
  32                 void                                    Set(BF_GUI_ViewMenu_Item *po_Src);
  33 
  34 virtual float                                   CalcWidth(BF_GUI_Setup_Font * po_Font);         
  35 virtual void                                    Draw(BF_GUI_DlgView_Menu *po_Parent,BView *po_Render,float f_PosY);     
  36 virtual bool                                    Invoke(BF_GUI_DlgView_Menu *po_Parent){return false;};
  37 virtual void                                    MakeFocus(BF_GUI_DlgView_Menu *po_Parent);
  38 };
  39 
  40 float
  41 BF_GUI_ViewMenu_CalcMaxWidth(BL_List *plo_Menu,BF_GUI_Setup_Font * po_Font,bool b_ShowIcons);
  42 float
  43 BF_GUI_ViewMenu_CalcTotalWidth(BL_List *plo_Menu,BF_GUI_Setup_Font * po_Font,bool b_ShowIcons);
  44 
  45 class BF_GUI_DlgView_Menu:public BF_GUI_DialogView{
  46 public:
  47                 BL_List                                 *ploMenu; // list of BF_GUI_ViewMenu_Item
  48                 int32                                   iNavCursorIndex;
  49                 bool                                    bDestroyMenu,bHideCursorOnDefocus;
  50                 
  51                                                                 BF_GUI_DlgView_Menu(
  52                                                                                 const BRect     &o_Rect,
  53                                                                                 const char      *pc_Name,
  54                                                                                 uint32  i_FollowType,
  55                                                                                 BL_List *plo_Menu);
  56                                                                 ~BF_GUI_DlgView_Menu();
  57                                                                 
  58 virtual void                                    MakeFocus(bool  b_Focused = true);
  59 virtual void                                    AttachedToWindow(void);
  60 virtual void                                    KeyDown(const char *bytes, int32 numBytes);
  61 virtual void                                    Draw(BRect o_Rect);             
  62 virtual void                                    DrawItems(BView *po_Render);
  63                 // virtual method, empty in this class
  64 virtual void                                    DrawItem(BView *po_Render,int32 i_Index,bool b_ReqDrawBack);
  65                 // virtual method
  66 virtual void                                    SaveToMessage(BMessage *po_Message);
  67                 //
  68                 void                                    SetColor_Text(BView * po_Render,bool b_IsFocused,BF_GUI_ViewMenu_Item *po_Item=NULL);
  69                 void                                    SetColor_Back(BView * po_Render,bool b_IsFocused);
  70                 //
  71 virtual void                                    SetList(BL_List *plo_NewMenu);
  72                 void                                    SortList(BL_List *plo_List);            
  73                 void                                    DeleteItemAt(int i_Index);
  74                 //
  75 virtual float                                   Height();
  76                 BF_GUI_ViewMenu_Item*   ItemAt(int32 i_Index);
  77                 BF_GUI_ViewMenu_Item*   ItemByTitle(const char *pc_Title);
  78                 BF_GUI_ViewMenu_Item*   FocusItem();
  79                 
  80 virtual void                                    AddItem(BF_GUI_ViewMenu_Item* po_Item,bool b_SetCursorOnItem=false);
  81                 
  82 virtual void                                    NavChangeCursor(int32 i_NewCursor,int i_DirectMove,bool b_Redraw=true);
  83 virtual void                                    NavEnter();
  84 virtual void                                    NavEscape();
  85 
  86 protected:              
  87                 void                                    Draw_FocusItemPointer(BPoint & o_PointStart,BView *po_Render);
  88 };
  89 
  90 #define  BF_GUI_DLGVIEW_VMENU_DEFAULT                           0x00001
  91 #define  BF_GUI_DLGVIEW_VMENU_SICON                                     0x00002
  92 #define  BF_GUI_DLGVIEW_VMENU_NAV_PARENTINFORM          0x00004
  93 #define  BF_GUI_DLGVIEW_VMENU_CAN_SELECTING                     0x00008
  94 #define  BF_GUI_DLGVIEW_VMENU_SET_VSCROLLBAR            0x00010
  95 
  96 
  97 class BF_GUI_DlgView_VMenu:public BF_GUI_DlgView_Menu{
  98 public:
  99                                                                 BF_GUI_DlgView_VMenu(
 100                                                                                 const BRect     &o_Rect,
 101                                                                                 const char      *pc_Name,
 102                                                                                 uint32  i_FollowType,
 103                                                                                 BL_List *plo_Menu,
 104                                                                                 uint32  i_Style = BF_GUI_DLGVIEW_VMENU_DEFAULT,
 105                                                                                 float   f_NewItemHeight=0);
 106 public: 
 107 virtual void                                    DrawItem(BView *po_Render,int32 i_Index,bool b_ReqDrawBack);
 108                 void                                    DrawItemExt(BView *po_Render,int32 i_Index,bool b_ReqDrawBack);
 109 virtual void                                    NavChangeCursor(int32 i_NewCursor,int i_DirectMove,bool b_Redraw=true);
 110 virtual void                                    DrawItems(BView *po_Render);
 111 
 112 virtual void                                    AttachedToWindow(void);
 113 virtual void                                    KeyDown(const char *bytes, int32 numBytes);
 114 virtual void                                    FrameResized(float width, float height);
 115 virtual void                                    MouseDown(BPoint point);
 116 
 117 virtual float                                   Height();
 118 virtual void                                    SetList(BL_List *plo_NewMenu);
 119 virtual void                                    AddItem(BF_GUI_ViewMenu_Item* po_Item,bool b_SetCursorOnItem=false);
 120 
 121                 void                                    SetVScroll(BF_GUI_VScrollBar *po_VScroll);
 122 protected:
 123                 uint32                                  iStyle;                         
 124                 float                                   fNewItemHeight;
 125                 void                                    NavSelect();            
 126                 BF_GUI_VScrollBar               *poVScroll;
 127                 
 128 virtual void                                    SaveToMessage(BMessage *po_Message);            
 129 public:
 130                 int32                                   iFirstIndex;
 131                 int32                                   iPageSize;
 132                 
 133 private:
 134                 void                                    CreateVScroll();
 135 };
 136 
 137 class BF_GUI_DlgView_VCMenu_Column:public BL_Object{
 138 public:
 139                 BL_String                               sName;
 140                 float                                   fWidth;
 141                 
 142                                                                 BF_GUI_DlgView_VCMenu_Column(const char *pc_ColName,float f_Width);
 143 };
 144 
 145 class BF_GUI_DlgView_VCMenu:public BF_GUI_DlgView_VMenu{
 146 public:
 147                                                                 BF_GUI_DlgView_VCMenu(
 148                                                                                 const BRect     &o_Rect,
 149                                                                                 const char      *pc_Name,
 150                                                                                 uint32  i_FollowType,
 151                                                                                 BL_List *plo_Menu,
 152                                                                                 uint32  i_Style, // BF_GUI_DLGVIEW_VMENU_DEFAULT
 153                                                                                 BL_List  *plo_Col);                                                                             
 154                                                                 ~BF_GUI_DlgView_VCMenu();
 155 virtual void                                    DrawItem(BView *po_Render,int32 i_Index,bool b_ReqDrawBack);
 156 protected:
 157                 BL_List                                 *ploCol;
 158 };
 159 
 160 
 161 class BF_GUI_DlgView_HMenu:public BF_GUI_DlgView_Menu{
 162 public:
 163                 
 164                                                                 BF_GUI_DlgView_HMenu(
 165                                                                                 const BRect &o_Rect,
 166                                                                                 const char      *pc_Name,
 167                                                                                 uint32  i_FollowType,
 168                                                                                 BL_List *plo_Menu);
 169 public: 
 170 virtual void                                    DrawItem(BView *po_Render,int32 i_Index,bool b_ReqDrawBack);
 171 virtual void                                    MouseDown(BPoint point);
 172 
 173                 float                                   CalcItemXPos(int32 i_Index);
 174 
 175 protected:
 176                 float                                   fItemsWidth;            
 177 public:
 178                 bool                                    bItemsInCenter;         
 179 };
 180 

/* [previous][next][first][last][top][bottom][index][help] */