1 #ifndef __BF_GUI_TOOLS_H__
2 #define __BF_GUI_TOOLS_H__
3
4 #include <String.h>
5 #include <Message.h>
6 #include <View.h>
7 #include <Window.h>
8
9 #include "BL_Tools.h"
10 #include "BF_GUI_Setup.h"
11 #include "BF_Msg.h"
12
13
14 #define BF_GUI_DIALOG_MESSAGE_DATA_OK "bf_bOk"
15
16 uint32
17 BF_GUI_GetTextLength(BString & s_Text,float f_Width,BFont & o_Font);
18
19 class BF_GUI_DialogView:public BView{
20 public:
21 BF_GUI_DialogView(const BRect oRect,const char* pc_Name,uint32 i_FollowMode,uint32 i_Flags);
22
23 virtual bool KeyDownExt(const char *bytes, int32 numBytes);
24 virtual void SaveToMessage(BMessage *po_Message){};
25 virtual void MessageReceived(BMessage* po_Message);
26 virtual void MouseDown(BPoint point);
27
28 virtual void SetSetupFont(BF_GUI_Setup_Font *po_Font);
29 BF_GUI_Setup_Font* Font(){return poFont;};
30
31 virtual void SetupUpdated();
32
33 protected:
34 BF_GUI_Setup_Font *poFont;
35 };
36
37 class BF_GUI_VScrollBar:public BF_GUI_DialogView{
38 public:
39 BF_GUI_VScrollBar(const BRect o_Rect,const char* pc_Name,uint32 i_FollowMode);
40 virtual void Draw(BRect o_Rect);
41
42 void SetLimits(int i_Limit,int i_VisibleLimit);
43 void SetCursor(int i_Cursor);
44 private:
45 int iLimit,iVisibleLimit,iCursor;
46 };
47
48
49 class BF_GUI_ViewFrame:public BF_GUI_DialogView{
50 public:
51 BF_GUI_ViewFrame(BRect & o_Rect,int32 i_FollowMode);
52 virtual void Draw(BRect o_Rect);
53 };
54
55 BF_GUI_ViewFrame*
56 BF_GUI_ViewFrame_Create(BView *po_ForView,BView *po_Parent);
57
58 #include "BF_GUI_Edit.h"
59
60 class BF_GUI_ViewCheck:public BF_GUI_DialogView{
61 public:
62 BL_String sTitle;
63
64 BF_GUI_ViewCheck(const BRect o_Rect,
65 const char *pc_Name,
66 const char *pc_Title,
67 bool b_Value,
68 uint32 i_FollowMode,
69 uint32 i_Flags);
70 ~BF_GUI_ViewCheck();
71 virtual void Draw(BRect o_Rect);
72 virtual void KeyDown(const char *bytes, int32 numBytes);
73 virtual void Pulse(void);
74 virtual void AttachedToWindow(void);
75 virtual void MessageReceived(BMessage* po_Message);
76 virtual void MakeFocus(bool focused = true);
77
78 virtual void MouseDown(BPoint point);
79
80 virtual void SaveToMessage(BMessage *po_Message);
81 protected:
82 bool bValue;
83 bool bPulseCursorShow;
84 thread_id idThreadPulse;
85
86 void DrawCursor(bool b_Show);
87 };
88
89 class BF_GUI_ViewCheck_Style:public BF_GUI_ViewCheck{
90 public:
91 BF_GUI_ViewCheck_Style(const BRect o_Rect,
92 const char *pc_Name,
93 const char *pc_Title,
94 uint32 *pi_SrcStyles,
95 uint32 i_SrcStyle,
96 uint32 i_FollowMode,
97 uint32 i_Flags);
98
99 virtual void SaveToMessage(BMessage *po_Message);
100 private:
101 uint32 *piSrcStyles;
102 uint32 iSrcStyle;
103 };
104
105 class BF_GUI_ViewText:public BF_GUI_DialogView{
106 public:
107 BString sTitle;
108
109 BF_GUI_ViewText(const BRect o_Rect,
110 const char *pc_Name,
111 const char *pc_Title,
112 uint32 i_FollowMode,
113 uint32 i_Flags,
114 bool b_AlignCenter=true);
115 virtual void Draw(BRect o_Rect);
116 private:
117 bool bAlignCenter;
118 };
119
120 class BF_GUI_ViewProgress:public BF_GUI_DialogView{
121 public:
122
123 BF_GUI_ViewProgress(const BRect o_Rect,
124 const char *pc_Name,
125 const char *pc_Title,
126 uint32 i_FollowMode,
127 uint32 i_Flags,
128 int64 *pi_Count=NULL,
129 int64 *pi_Index=NULL);
130 ~BF_GUI_ViewProgress();
131 void SetLimit(int64 i_Count);
132 void Step(int64 i_Delta=1);
133 void SetControls(int64 *pi_Count,
134 int64 *pi_Index);
135
136
137 virtual void Draw(const BRect o_Rect);
138 virtual void MessageReceived(BMessage* po_Message);
139
140 virtual void AttachedToWindow(void);
141 virtual void Pulse(void);
142
143
144
145 private:
146 BString sTitle;
147 int64 iCount,iIndex;
148 float fDelta;
149 int64 *piCount;
150 int64 *piIndex;
151 };
152
153
154
155
156
157
158
159
160
161
162 #define BG_GUI_DIALOG_WINRESIZE_NONE 0
163 #define BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER 1
164 #define BG_GUI_DIALOG_WINRESIZE_MOVE_RCENTER 2
165 #define BG_GUI_DIALOG_WINRESIZE_RESIZE_ALL 3
166
167 class BF_GUI_DlgPanel:public BView{
168 public:
169 BF_GUI_DlgPanel(const BRect & o_Rect,
170 const char *pc_Title,
171 const char *pc_Name,
172 int i_FollowMode,
173 int i_Styles,
174 bool b_DoubleBorder=true);
175 virtual void Draw(BRect o_Rect);
176 virtual void MouseDown(BPoint point);
177 virtual void MessageReceived(BMessage* po_Message);
178 void LocalBounds(BRect & o_Rect);
179
180 void SetSizeBy(float f_X,float f_Y);
181 void SetHeightFromLastChild();
182 void MoveToCenter(BView *po_View);
183
184 void AddMenu(BRect & o_Rect,BL_List *plo_Menu,bool b_RectInited=false);
185 void AddOkCancelMenu(BRect & o_Rect,bool b_RectInited=false);
186
187 public:
188 float fShadowX,fShadowY;
189 float fBorderH,fBorderTop,fBorderBottom;
190
191 protected:
192 BString sTitle;
193
194 };
195
196 class BF_GUI_Dialog:public BF_GUI_DlgPanel{
197 public:
198 BF_GUI_Dialog(
199 const BRect & o_Rect,
200 const char *pc_Title,
201 const char *pc_Name,
202 const BMessage &o_Message,
203 uint32 i_WinResizeType,
204 bool b_DoubleBorder=true);
205 virtual void MessageReceived(BMessage* po_Message);
206 virtual void AttachedToWindow(void);
207
208 virtual void MouseDown(BPoint point);
209
210 void EnableDialog(bool b_Enable);
211 void FocusFirstView();
212
213 BMessage* Message();
214
215 protected:
216 BMessage oMessage;
217 uint32 iWinResizeType;
218
219 virtual void Save(BMessage& o_Message);
220 virtual bool ReadyForClose(){return true;};
221 };
222
223
224
225 int32
226 BF_Dialog_Alert(const char *pc_Title,const char *pc_Text,
227 BL_List *plo_MenuItem=NULL,
228 const char *pc_Text1=NULL);
229
230 void
231 BF_Dialog_Alert_Sep(const char *pc_Title,const char *pc_Text,
232 BL_List *plo_MenuItem,
233 BView *po_ViewOwner,
234 const char *pc_Text1=NULL,
235 int32 i_MessageWhat=BF_MSG_PANEL_FOCUS_AND_ENABLE);
236
237 void
238 BF_Dialog_Alert_Sep_Error(status_t uRes,BView *po_ViewOwner);
239
240 #include "BF_GUI_DlgViews_Menu.h"
241
242 #endif