xref: /haiku/src/kits/tracker/infowindow/GeneralInfoView.h (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
1 /*
2 Open Tracker License
3 
4 Terms and Conditions
5 
6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy of
9 this software and associated documentation files (the "Software"), to deal in
10 the Software without restriction, including without limitation the rights to
11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 of the Software, and to permit persons to whom the Software is furnished to do
13 so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice applies to all licensees
16 and shall be included in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 Except as contained in this notice, the name of Be Incorporated shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings in
27 this Software without prior written authorization from Be Incorporated.
28 
29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30 of Be Incorporated in the United States and other countries. Other brand product
31 names are registered trademarks or trademarks of their respective holders.
32 All rights reserved.
33 */
34 
35 #ifndef GENERALINFOVIEW_H
36 #define GENERALINFOVIEW_H
37 
38 
39 #include <fs_info.h>
40 #include <GroupView.h>
41 #include <MenuField.h>
42 #include <Message.h>
43 #include <Rect.h>
44 #include <TextView.h>
45 
46 #include "DialogPane.h"
47 #include "Model.h"
48 
49 
50 namespace BPrivate {
51 
52 // States for tracking the mouse
53 enum track_state {
54 	no_track = 0,
55 	link_track,
56 	path_track,
57 	size_track,
58 };
59 
60 
61 class GeneralInfoView : public BGroupView {
62 public:
63 	GeneralInfoView(Model*);
64 	~GeneralInfoView();
65 
66 	void ModelChanged(Model*, BMessage*);
67 	void ReLinkTargetModel(Model*);
68 	float CurrentFontHeight();
69 
70 	off_t LastSize() const;
71 	void SetLastSize(off_t);
72 
73 	void SetSizeString(const char*);
74 
75 protected:
76 	virtual void MouseDown(BPoint where);
77 	virtual void MouseMoved(BPoint where, uint32, const BMessage* dragMessage);
78 	virtual void MouseUp(BPoint where);
79 	virtual void MessageReceived(BMessage* message);
80 	virtual void AttachedToWindow();
81 	virtual void FrameResized(float, float);
82 	virtual void Draw(BRect);
83 	virtual void Pulse();
84 	virtual void WindowActivated(bool active);
85 
86 private:
87 	void InitStrings(const Model*);
88 	void CheckAndSetSize();
89 	void OpenLinkSource();
90 	void OpenLinkTarget();
91 
92 	BString fPathStr;
93 	BString fLinkToStr;
94 	BString fSizeString;
95 	BString fModifiedStr;
96 	BString fCreatedStr;
97 	BString fKindStr;
98 	BString fDescStr;
99 	BString fFileSystemStr;
100 
101 	off_t fFreeBytes;
102 	off_t fLastSize;
103 
104 	BRect fPathRect;
105 	BRect fLinkRect;
106 	BRect fDescRect;
107 	BRect fSizeRect;
108 	float fDivider;
109 
110 	BMenuField* fPreferredAppMenu;
111 	Model* fModel;
112 	bool fMouseDown;
113 	track_state fTrackingState;
114 	BWindow* fPathWindow;
115 	BWindow* fLinkWindow;
116 	BWindow* fDescWindow;
117 	color_which fCurrentLinkColorWhich;
118 	color_which fCurrentPathColorWhich;
119 
120 	typedef BGroupView _inherited;
121 };
122 
123 }	// namespace BPrivate
124 
125 
126 const uint32 kPermissionsSelected = 'sepe';
127 const uint32 kRecalculateSize = 'resz';
128 const uint32 kSetLinkTarget = 'link';
129 
130 
131 #endif /* !GENERALINFOVIEW_H */
132