1 #ifndef __BF_GUI_NODEPANEL_H__
2 #define __BF_GUI_NODEPANEL_H__
3
4 #include <View.h>
5 #include <Window.h>
6 #include "BL_Tools.h"
7 #include "BF_Node.h"
8 #include "BF_GUI_Setup.h"
9 #include "BF_GUI_DlgViews.h"
10 #include "BF_GUI_Func.h"
11
12 enum {
13 BF_NODEPANEL_MODE_FULL=0,
14 BF_NODEPANEL_MODE_COLS
15 };
16
17 #define BF_NODEPANEL_FULL_NAME 1
18 #define BF_NODEPANEL_FULL_DATE 2
19 #define BF_NODEPANEL_FULL_SIZE 4
20 #define BF_NODEPANEL_FULL_TYPE 8
21 #define BF_NODEPANEL_FULL_SICON 16
22 #define BF_NODEPANEL_FULL_ALL 255
23
24 #define BF_NODEPANEL_COLS_NAME 1
25 #define BF_NODEPANEL_COLS_SICON 32
26
27 #define BF_NODEPANEL_PULSE_NONE 0
28 #define BF_NODEPANEL_PULSE_MOVEUP 1
29 #define BF_NODEPANEL_PULSE_MOVEDOWN 2
30 #define BF_NODEPANEL_PULSE_ALL 255
31
32
33 #define BF_NODEPANEL_COPY_NOTETYPES_FIELD "bf_iCopyNodeTypes"
34
35
36 class BF_GUI_NodePanel:public BF_GUI_Panel{
37
38 public:
39 float fWidth,fNodesHeight,fNodeHeight,fColTitleHeight,fNodeInfoHeight,fSelInfoHeight;
40
41 float fFullName,fFullType,fFullSize,fFullDate,fFullSIcon;
42 uint32 iModeFullStyles;
43
44 float fColsName,fColsSIcon,fColsColWidth;
45 uint32 iModeColsStyles;
46 uint32 iColsColCount,iColsNodesInCol;
47
48 uint32 iMode;
49 BF_NodeList_SortType iSortType;
50
51
52 int32 iNavFirstIndex;
53 int32 iNavCursorIndex;
54 int32 iNodesOnScreen;
55
56
57 BF_GUI_NodePanel(const BRect & o_Rect,bool b_WinPos_OnLeft);
58 ~BF_GUI_NodePanel();
59
60 virtual void DrawPanel(BRect & o_Rect);
61 virtual void FrameResized(float width, float height);
62 virtual BRect ClientRect();
63 virtual void Calc();
64
65 virtual void OnEnable(bool b_Enable);
66
67 virtual bool OnMouseDown(BPoint & o_Point);
68 virtual bool OnMouseUp(BPoint & o_Point);
69 virtual void MouseMoved(BPoint o_Point,uint32 i_Transit,const BMessage *message);
70
71 virtual void PrepareKeysMenu();
72 virtual void PrepareTopMenuItem(BF_GUI_TopMenu_HItem *po_HItem);
73 virtual void PrepareHotKeys(bool b_Focused);
74
75 virtual bool OnKeyDown(const char *bytes, int32 numBytes);
76 virtual bool OnBeforeKeyDown(const char *bytes, int32 numBytes);
77
78 virtual void ChangeSortType(BF_NodeList_SortType i_NewSortType);
79
80 virtual void RefreshNodeList();
81
82 virtual bool NavChangeCursor(int i_NewCursor,bool b_DrawNodes=true,bool b_ChangeVars=true);
83 virtual bool NavEnter();
84 virtual void NavGoParentDir();
85
86 virtual void DrawListInfo(bool b_DrawBack);
87
88 virtual void ActionRename_Run(BF_NodeCollection & lo_Node,BL_String & s_NewName);
89 virtual void ActionDelete_Run(BF_NodeCollection & lo_Node);
90 virtual void ActionCopyTo_Run(BL_String & s_Path,BF_NodeCollection & lo_Node);
91 virtual void ActionMoveTo_Run(BL_String & s_Path,BF_NodeCollection & lo_Node);
92 virtual void ActionMakeDir_Run(BL_String & s_Title);
93 virtual void ActionCopyFrom_Run(BL_String & s_Path,BF_NodeCollection & lo_Node,bool b_Move);
94
95 virtual void Action_SwitchShowIcons();
96 virtual void OnFocus(bool b_Focused);
97
98 virtual void MessageReceived(BMessage* po_Message);
99
100 virtual void StoreVars(BF_GUI_Setup_Vars_Panel & o_Setup) const;
101
102
103 void ActionCopyTo_Start();
104 void ActionDelete_Start();
105 void ActionMoveTo_Start();
106 void ActionMakeDir_Start();
107 void ActionRename_Start();
108
109 bool ModeShowSIcon();
110 void SetModeShowSIcon(bool b_ShowIcons);
111
112 bool NavToStart();
113 bool NavToEnd();
114 bool NavDown();
115 bool NavUp();
116 bool NavRight();
117 bool NavLeft();
118 bool NavPgDown();
119 bool NavPgUp();
120
121 bool NavSelect(bool b_CursorGoNext=true);
122 bool NavSelectAll_0(int32 i_Key);
123 void NavSelectAll_1(BMessage *po_Message);
124 void NavDeselectAll();
125
126 void DrawStringRight(const char *pc_Text,BPoint &o_Point,float f_Width);
127 void DrawStringCenter(const char *pc_Text,BPoint &o_Point,float f_Width);
128
129 void DrawLines(bool b_OnlyNodes);
130 void DrawColTitles();
131 void DrawSelListInfo(bool b_DrawBack);
132 void DrawNodeInfo();
133 void DrawNodes(bool b_DrawBackground=false);
134 void DrawNodeAt(int32 i_Index);
135 void DrawNode(
136 int32 i_NodeIndex,
137 bool b_ItCursor,
138 BPoint &oPoint,
139 BRect & oRect,
140 char *pc_Buffer,
141 BRect *po_RectBound,
142 bool b_DrawBackground,
143 bool b_UsePoint=false);
144 void DrawNodeSelf(
145 int32 i_NodeIndex,
146 bool b_ItCursor,
147 bool b_DrawBackground,
148 bool b_OffScreen=false);
149 void DrawNode_CursorBack(
150 BF_Node *po_Node,
151 BRect& oRect,
152 BPoint& oPoint,
153 float f_Width,
154 bool b_Cursor);
155 void DrawNode_SetNodeColor(BF_Node *po_Node,bool b_IsFocus);
156 void DrawMove_ColsDown();
157 void DrawMove_ColsUp();
158 void DrawMove_ColsRight();
159 void DrawMove_ColsLeft();
160 void DrawMove_FullUp();
161 void DrawMove_FullDown();
162
163 void Action_Alert(const char *pc_Title,const char *pc_Text);
164
165 BF_NodeCollection* Nodes_GetSelecting();
166 BF_Node* Nodes_Focus();
167 virtual void Nodes_Add(BF_Node *po_Node,BF_NodeCollection *plo_Node);
168 virtual void Nodes_Remove( BF_Node *po_Node, BF_NodeCollection *plo_Node);
169 virtual void Nodes_Update( BF_Node *po_Node, BF_NodeCollection *plo_Node);
170 virtual void Nodes_GetAll(BF_NodeList& lo_ResultNode,bool b_ReqIcons);
171 virtual void Nodes_SetSelectingByName( BF_NodeList* plo_ReqNode,uint i_SelAction,bool b_ReqUpdate=true);
172
173 void PulseAction_Add(int32 i_NewActions);
174 void PulseAction_Remove(int32 i_NewActions);
175 virtual void Pulse(void);
176
177
178 void PanelSetup_0();
179 void PanelSetup_1(BMessage *po_Message);
180
181
182
183 protected:
184 BF_NodeList loNode;
185 int32 iPulseActions;
186
187 BString sNodeSelMask;
188 bool bSelectDirAlso;
189 bool bCanSelect;
190
191 BL_String sDictDir;
192
193 private:
194 thread_id idThreadPulse;
195
196 };
197
198
199 #endif