| | [ Return to Bugs & Features | SVN ⇄ GIT ]
STR #2446
| Application: | FLTK Library |
| Status: | 1 - Closed w/Resolution |
| Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
| Scope: | 3 - Applies to all machines and operating systems |
| Subsystem: | Core Library |
| Summary: | Allow easy customization for special purposes |
| Version: | 1.4-feature |
| Created By: | mingodad |
| Assigned To: | matt |
| Fix Version: | Will Not Fix |
| Update Notification: | |
Trouble Report Files:
No files
Trouble Report Comments:
| |
| #1 | mingodad 15:29 Nov 15, 2010 |
| I propose that fltk headers should have included a preprocessor directive to easy customizations like that by developers, something like this: ------ #include <FL/User_defined.H> class FL_EXPORT Fl_Float_Input : public Fl_Input { public: /** Creates a new Fl_Float_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. <P> Inherited destructor destroys the widget and any value associated with it */ Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0) : Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);right_to_left_=1;} #ifdef USER_CUSTOM_DEFINED_FOR_FL_FLOAT_INPUT USER_CUSTOM_DEFINED_FOR_FL_FLOAT_INPUT; #endif }; -------- Example of a possible "<FL/User_defined.H>" -------- #define USER_CUSTOM_DEFINED_FOR_FL_WIDGET \ const char* field_name; \ char* storage_space; \ virtual bool validate_value() {return 0;}; #define USER_CUSTOM_DEFINED_FOR_FL_WIDGET_ON_CONSTRUTOR \ const char* field_name = NULL; \ char *storage_space = NULL; #define USER_CUSTOM_DEFINED_FOR_FL_WIDGET_ON_DESTRUCTOR \ if(field_name) free(field_name); \ if(storage_space) free(storage_space); #define USER_CUSTOM_DEFINED_FOR_FL_FLOAT_INPUT \ bool allow_negative_values; \ virtual bool validate_value() {return allow_negative_values ? true : value_float() > = 0;}; #define USER_CUSTOM_DEFINED_FOR_FL_FLOAT_INPUT_ON_CONSTRUCTOR \ allow_negative_values = true; -------- This way we can customize fltk for a lot of needs without having to derive new widgets only editing the "<FL/User_defined.H>" and include our definition file to the library, and we can update fltk sources without much worry about our customizations. | |
| |
| #2 | matt 13:32 Nov 16, 2010 |
| Sorry, I have to delay this until after the 1.3.0 release. | |
| |
| #3 | matt 14:05 Apr 13, 2026 |
| Sorry, that's exactly what deriving a class is for. This does not belong in the core library. | |
| |
| #4 | matt 14:05 Apr 13, 2026 |
| Sorry, that's exactly what deriving a class is for. This does not belong in the core library. | |
[ Return to Bugs & Features ]
|
| |