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