From 74824267355c4ac6f51bcec10bdf66b45b46ee0a Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 11 Apr 2002 11:52:43 +0000 Subject: Make Fl_Output a subclass of Fl_Input, and add input_type and readonly methods/constants to support Fl_Output as a special case of Fl_Input (you can do everything but change the text in Fl_Output...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2073 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Input_.H | 14 ++++++++++++-- FL/Fl_Multiline_Output.H | 6 +++--- FL/Fl_Output.H | 13 +++++-------- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Input_.H b/FL/Fl_Input_.H index dd43a6dc1..b0504412d 100644 --- a/FL/Fl_Input_.H +++ b/FL/Fl_Input_.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input_.H,v 1.6.2.4.2.3 2002/03/07 19:22:56 spitzak Exp $" +// "$Id: Fl_Input_.H,v 1.6.2.4.2.4 2002/04/11 11:52:40 easysw Exp $" // // Input base class header file for the Fast Light Tool Kit (FLTK). // @@ -36,6 +36,10 @@ #define FL_HIDDEN_INPUT 3 #define FL_MULTILINE_INPUT 4 #define FL_SECRET_INPUT 5 +#define FL_INPUT_TYPE 7 +#define FL_INPUT_READONLY 8 +#define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY) +#define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY) class Fl_Input_ : public Fl_Widget { @@ -117,10 +121,16 @@ public: void textcolor(unsigned n) {textcolor_ = n;} Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;} void cursor_color(unsigned n) {cursor_color_ = n;} + + int input_type() const {return type() & FL_INPUT_TYPE; } + void input_type(int t) { type(t | readonly()); } + int readonly() const { return type() & FL_INPUT_READONLY; } + void readonly(int b) { if (b) type(type() | FL_INPUT_READONLY); + else type(type() & FL_INPUT_TYPE); } }; #endif // -// End of "$Id: Fl_Input_.H,v 1.6.2.4.2.3 2002/03/07 19:22:56 spitzak Exp $". +// End of "$Id: Fl_Input_.H,v 1.6.2.4.2.4 2002/04/11 11:52:40 easysw Exp $". // diff --git a/FL/Fl_Multiline_Output.H b/FL/Fl_Multiline_Output.H index 0f5b550f1..ea1d51ce4 100644 --- a/FL/Fl_Multiline_Output.H +++ b/FL/Fl_Multiline_Output.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Multiline_Output.H,v 1.4.2.3.2.1 2002/01/01 15:11:28 easysw Exp $" +// "$Id: Fl_Multiline_Output.H,v 1.4.2.3.2.2 2002/04/11 11:52:41 easysw Exp $" // // Multi line output header file for the Fast Light Tool Kit (FLTK). // @@ -31,11 +31,11 @@ class Fl_Multiline_Output : public Fl_Output { public: Fl_Multiline_Output(int x,int y,int w,int h,const char *l = 0) - : Fl_Output(x,y,w,h,l) {type(FL_MULTILINE_INPUT);} + : Fl_Output(x,y,w,h,l) {type(FL_MULTILINE_OUTPUT);} }; #endif // -// End of "$Id: Fl_Multiline_Output.H,v 1.4.2.3.2.1 2002/01/01 15:11:28 easysw Exp $". +// End of "$Id: Fl_Multiline_Output.H,v 1.4.2.3.2.2 2002/04/11 11:52:41 easysw Exp $". // diff --git a/FL/Fl_Output.H b/FL/Fl_Output.H index 3e57b5dec..25eafba90 100644 --- a/FL/Fl_Output.H +++ b/FL/Fl_Output.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Output.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $" +// "$Id: Fl_Output.H,v 1.5.2.3.2.2 2002/04/11 11:52:41 easysw Exp $" // // Output header file for the Fast Light Tool Kit (FLTK). // @@ -26,19 +26,16 @@ #ifndef Fl_Output_H #define Fl_Output_H -#include "Fl_Input_.H" +#include "Fl_Input.H" -class Fl_Output : public Fl_Input_ { -protected: - FL_EXPORT void draw(); +class Fl_Output : public Fl_Input { public: - FL_EXPORT int handle(int); Fl_Output(int x, int y, int w, int h, const char *l = 0) - : Fl_Input_(x, y, w, h, l) {} + : Fl_Input(x, y, w, h, l) {type(FL_NORMAL_OUTPUT);} }; #endif // -// End of "$Id: Fl_Output.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $". +// End of "$Id: Fl_Output.H,v 1.5.2.3.2.2 2002/04/11 11:52:41 easysw Exp $". // -- cgit v1.2.3