1e234c034SDarkWyrm /* 2e234c034SDarkWyrm * Copyright (c) 2005-2010, Haiku, Inc. 3e234c034SDarkWyrm * Distributed under the terms of the MIT license. 4e234c034SDarkWyrm * 5e234c034SDarkWyrm * Author: 6e234c034SDarkWyrm * DarkWyrm <darkwyrm@gmail.com> 7e234c034SDarkWyrm */ 822c6ae69SDarkWyrm #ifndef INTERNALEDITORS_H 922c6ae69SDarkWyrm #define INTERNALEDITORS_H 1022c6ae69SDarkWyrm 1122c6ae69SDarkWyrm #include <Button.h> 12*55779173SDarkWyrm #include <TextControl.h> 13*55779173SDarkWyrm #include <StringView.h> 14*55779173SDarkWyrm #include <View.h> 15*55779173SDarkWyrm 1622c6ae69SDarkWyrm #include "Editor.h" 1722c6ae69SDarkWyrm 1822c6ae69SDarkWyrm class StringEditView : public BView 1922c6ae69SDarkWyrm { 2022c6ae69SDarkWyrm public: 2122c6ae69SDarkWyrm StringEditView(const BRect &frame); 2222c6ae69SDarkWyrm ~StringEditView(void); 2322c6ae69SDarkWyrm 2422c6ae69SDarkWyrm void AttachedToWindow(void); 2522c6ae69SDarkWyrm GetID(void)2622c6ae69SDarkWyrm const char * GetID(void) const { return fIDBox->Text(); } SetID(const char * idstring)2722c6ae69SDarkWyrm void SetID(const char *idstring) { fIDBox->SetText(idstring); } 2822c6ae69SDarkWyrm GetName(void)2922c6ae69SDarkWyrm const char * GetName(void) const { return fNameBox->Text(); } SetName(const char * name)3022c6ae69SDarkWyrm void SetName(const char *name) { fNameBox->SetText(name); } 3122c6ae69SDarkWyrm GetValue(void)32*55779173SDarkWyrm const char * GetValue(void) const { return fValueView->Text(); } SetValue(const char * value)33*55779173SDarkWyrm void SetValue(const char *value) { fValueView->SetText(value); } 3422c6ae69SDarkWyrm EnableID(const bool & value)3522c6ae69SDarkWyrm void EnableID(const bool &value) { fIDBox->SetEnabled(value); } IsIDEnabled(void)3622c6ae69SDarkWyrm bool IsIDEnabled(void) const { return fIDBox->IsEnabled(); } 3722c6ae69SDarkWyrm 3822c6ae69SDarkWyrm float GetPreferredWidth(void) const; 3922c6ae69SDarkWyrm float GetPreferredHeight(void) const; 4022c6ae69SDarkWyrm 4122c6ae69SDarkWyrm private: 4222c6ae69SDarkWyrm BTextControl *fIDBox, 43*55779173SDarkWyrm *fNameBox; 44*55779173SDarkWyrm BTextView *fValueView; 4522c6ae69SDarkWyrm 4622c6ae69SDarkWyrm BButton *fCancel, 4722c6ae69SDarkWyrm *fOK; 4822c6ae69SDarkWyrm }; 4922c6ae69SDarkWyrm 5022c6ae69SDarkWyrm class DoubleEditor : public Editor 5122c6ae69SDarkWyrm { 5222c6ae69SDarkWyrm public: 5322c6ae69SDarkWyrm DoubleEditor(const BRect &frame, ResourceData *data, 5422c6ae69SDarkWyrm BHandler *owner); 5522c6ae69SDarkWyrm void MessageReceived(BMessage *msg); 5622c6ae69SDarkWyrm 5722c6ae69SDarkWyrm private: 5822c6ae69SDarkWyrm StringEditView *fView; 5922c6ae69SDarkWyrm }; 6022c6ae69SDarkWyrm 6122c6ae69SDarkWyrm class StringEditor : public Editor 6222c6ae69SDarkWyrm { 6322c6ae69SDarkWyrm public: 6422c6ae69SDarkWyrm StringEditor(const BRect &frame, ResourceData *data, 6522c6ae69SDarkWyrm BHandler *owner); 6622c6ae69SDarkWyrm void MessageReceived(BMessage *msg); 6722c6ae69SDarkWyrm 6822c6ae69SDarkWyrm private: 6922c6ae69SDarkWyrm StringEditView *fView; 7022c6ae69SDarkWyrm }; 7122c6ae69SDarkWyrm 7222c6ae69SDarkWyrm class BitmapView; 7322c6ae69SDarkWyrm 7422c6ae69SDarkWyrm class ImageEditor : public Editor 7522c6ae69SDarkWyrm { 7622c6ae69SDarkWyrm public: 7722c6ae69SDarkWyrm ImageEditor(const BRect &frame, ResourceData *data, 7822c6ae69SDarkWyrm BHandler *owner); 7922c6ae69SDarkWyrm ~ImageEditor(void); 8022c6ae69SDarkWyrm void MessageReceived(BMessage *msg); 8122c6ae69SDarkWyrm void FrameResized(float w, float h); 8222c6ae69SDarkWyrm 8322c6ae69SDarkWyrm private: 8422c6ae69SDarkWyrm BTextControl *fIDBox; 8522c6ae69SDarkWyrm BTextControl *fNameBox; 8622c6ae69SDarkWyrm 8722c6ae69SDarkWyrm BButton *fOK, 8822c6ae69SDarkWyrm *fCancel; 8922c6ae69SDarkWyrm 9022c6ae69SDarkWyrm BBitmap *fImage; 9122c6ae69SDarkWyrm BitmapView *fImageView; 9222c6ae69SDarkWyrm }; 9322c6ae69SDarkWyrm 9422c6ae69SDarkWyrm #endif 95