FLTK logo

STR #2446

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Post Text | Post File | SVN ⇄ GIT | Prev | Next ]

STR #2446

Application:FLTK Library
Status:5 - New
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:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files


Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
 
#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.  
     

Return to Bugs & Features | Post Text | Post File ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.