xref: /haiku/src/kits/tracker/infowindow/GeneralInfoView.h (revision 0f9ffb37c166a9d9257044c8937f6450f4257b75)
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 <GroupView.h>
40 #include <MenuField.h>
41 #include <Message.h>
42 #include <Rect.h>
43 #include <TextView.h>
44 
45 #include "DialogPane.h"
46 #include "Model.h"
47 
48 
49 namespace BPrivate {
50 
51 // States for tracking the mouse
52 enum track_state {
53 	no_track = 0,
54 	link_track,
55 	path_track,
56 	size_track,
57 };
58 
59 
60 class GeneralInfoView : public BGroupView {
61 public:
62 	GeneralInfoView(Model*);
63 	~GeneralInfoView();
64 
65 	void ModelChanged(Model*, BMessage*);
66 	void ReLinkTargetModel(Model*);
67 	float CurrentFontHeight();
68 
69 	off_t LastSize() const;
70 	void SetLastSize(off_t);
71 
72 	void SetSizeString(const char*);
73 
74 protected:
75 	virtual void MouseDown(BPoint where);
76 	virtual void MouseMoved(BPoint where, uint32, const BMessage* dragMessage);
77 	virtual void MouseUp(BPoint where);
78 	virtual void MessageReceived(BMessage* message);
79 	virtual void AttachedToWindow();
80 	virtual void FrameResized(float, float);
81 	virtual void Draw(BRect);
82 	virtual void Pulse();
83 	virtual void WindowActivated(bool active);
84 
85 private:
86 	void InitStrings(const Model*);
87 	void CheckAndSetSize();
88 	void OpenLinkSource();
89 	void OpenLinkTarget();
90 
91 	BString fPathStr;
92 	BString fLinkToStr;
93 	BString fSizeString;
94 	BString fModifiedStr;
95 	BString fCreatedStr;
96 	BString fKindStr;
97 	BString fDescStr;
98 
99 	off_t fFreeBytes;
100 	off_t fLastSize;
101 
102 	BRect fPathRect;
103 	BRect fLinkRect;
104 	BRect fDescRect;
105 	BRect fSizeRect;
106 	float fDivider;
107 
108 	BMenuField* fPreferredAppMenu;
109 	Model* fModel;
110 	bool fMouseDown;
111 	track_state fTrackingState;
112 	BWindow* fPathWindow;
113 	BWindow* fLinkWindow;
114 	BWindow* fDescWindow;
115 	color_which fCurrentLinkColorWhich;
116 	color_which fCurrentPathColorWhich;
117 
118 	typedef BGroupView _inherited;
119 };
120 
121 }	// namespace BPrivate
122 
123 
124 const uint32 kPermissionsSelected = 'sepe';
125 const uint32 kRecalculateSize = 'resz';
126 const uint32 kSetLinkTarget = 'link';
127 
128 
129 #endif /* !GENERALINFOVIEW_H */
130