1/*
2Open Tracker License
3
4Terms and Conditions
5
6Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
7
8Permission is hereby granted, free of charge, to any person obtaining a copy of
9this software and associated documentation files (the "Software"), to deal in
10the Software without restriction, including without limitation the rights to
11use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12of the Software, and to permit persons to whom the Software is furnished to do
13so, subject to the following conditions:
14
15The above copyright notice and this permission notice applies to all licensees
16and shall be included in all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25Except as contained in this notice, the name of Be Incorporated shall not be
26used in advertising or otherwise to promote the sale, use or other dealings in
27this Software without prior written authorization from Be Incorporated.
28
29Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30of Be Incorporated in the United States and other countries. Other brand product
31names are registered trademarks or trademarks of their respective holders.
32All 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
50namespace BPrivate {
51
52// States for tracking the mouse
53enum track_state {
54	no_track = 0,
55	link_track,
56	path_track,
57	size_track,
58};
59
60
61class GeneralInfoView : public BGroupView {
62public:
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
75protected:
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
86private:
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
126const uint32 kPermissionsSelected = 'sepe';
127const uint32 kRecalculateSize = 'resz';
128const uint32 kSetLinkTarget = 'link';
129
130
131#endif /* !GENERALINFOVIEW_H */
132