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