xref: /haiku/src/apps/resedit/InternalEditors.h (revision 2600324b57fa31cdea1627d584d314f2a579c4a8)
1 #ifndef INTERNALEDITORS_H
2 #define INTERNALEDITORS_H
3 
4 #include <View.h>
5 #include <TextControl.h>
6 #include <Button.h>
7 #include "Editor.h"
8 
9 class StringEditView : public BView
10 {
11 public:
12 					StringEditView(const BRect &frame);
13 					~StringEditView(void);
14 
15 	void			AttachedToWindow(void);
16 
17 	const char *	GetID(void) const { return fIDBox->Text(); }
18 	void			SetID(const char *idstring) { fIDBox->SetText(idstring); }
19 
20 	const char *	GetName(void) const { return fNameBox->Text(); }
21 	void			SetName(const char *name) { fNameBox->SetText(name); }
22 
23 	const char *	GetValue(void) const { return fValueBox->Text(); }
24 	void			SetValue(const char *value) { fValueBox->SetText(value); }
25 
26 	void			EnableID(const bool &value) { fIDBox->SetEnabled(value); }
27 	bool			IsIDEnabled(void) const { return fIDBox->IsEnabled(); }
28 
29 	float			GetPreferredWidth(void) const;
30 	float			GetPreferredHeight(void) const;
31 
32 private:
33 	BTextControl	*fIDBox,
34 					*fNameBox,
35 					*fValueBox;
36 
37 	BButton			*fCancel,
38 					*fOK;
39 };
40 
41 class DoubleEditor : public Editor
42 {
43 public:
44 			DoubleEditor(const BRect &frame, ResourceData *data,
45 						BHandler *owner);
46 	void	MessageReceived(BMessage *msg);
47 
48 private:
49 	StringEditView	*fView;
50 };
51 
52 class StringEditor : public Editor
53 {
54 public:
55 			StringEditor(const BRect &frame, ResourceData *data,
56 						BHandler *owner);
57 	void	MessageReceived(BMessage *msg);
58 
59 private:
60 	StringEditView	*fView;
61 };
62 
63 class BitmapView;
64 
65 class ImageEditor : public Editor
66 {
67 public:
68 			ImageEditor(const BRect &frame, ResourceData *data,
69 						BHandler *owner);
70 			~ImageEditor(void);
71 	void	MessageReceived(BMessage *msg);
72 	void	FrameResized(float w, float h);
73 
74 private:
75 	BTextControl	*fIDBox;
76 	BTextControl	*fNameBox;
77 
78 	BButton			*fOK,
79 					*fCancel;
80 
81 	BBitmap			*fImage;
82 	BitmapView		*fImageView;
83 };
84 
85 #endif
86