1998-10-21 16:29:01 +00:00
|
|
|
//
|
|
|
|
|
// Widget type header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
|
//
|
2021-10-17 10:24:39 +00:00
|
|
|
// Copyright 1998-2021 by Bill Spitzak and others.
|
1998-10-21 16:29:01 +00:00
|
|
|
//
|
2011-07-19 04:49:30 +00:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// https://www.fltk.org/COPYING.php
|
1998-10-21 16:29:01 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 00:13:17 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// https://www.fltk.org/bugs.php
|
1998-10-21 16:29:01 +00:00
|
|
|
//
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
#ifndef _FLUID_FL_TYPE_H
|
|
|
|
|
#define _FLUID_FL_TYPE_H
|
2021-10-17 10:24:39 +00:00
|
|
|
|
1998-10-06 18:21:25 +00:00
|
|
|
#include <FL/Fl_Widget.H>
|
2005-03-08 13:46:31 +00:00
|
|
|
#include <FL/fl_draw.H>
|
2021-10-17 10:24:39 +00:00
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
class Fl_Type;
|
2021-12-11 18:43:00 +00:00
|
|
|
class Fl_Group_Type;
|
|
|
|
|
class Fl_Window_Type;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
kAddAsLastChild = 0,
|
|
|
|
|
kAddAfterCurrent
|
|
|
|
|
} Strategy;
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
void fixvisible(Fl_Type *p);
|
|
|
|
|
void delete_all(int selected_only=0);
|
|
|
|
|
int storestring(const char *n, const char * & p, int nostrip=0);
|
2016-07-18 21:12:25 +00:00
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
void select_all_cb(Fl_Widget *,void *);
|
|
|
|
|
void select_none_cb(Fl_Widget *,void *);
|
|
|
|
|
void earlier_cb(Fl_Widget*,void*);
|
|
|
|
|
void later_cb(Fl_Widget*,void*);
|
2005-03-19 08:38:21 +00:00
|
|
|
|
1998-10-06 18:21:25 +00:00
|
|
|
class Fl_Type {
|
|
|
|
|
|
|
|
|
|
friend class Widget_Browser;
|
2014-02-04 00:34:41 +00:00
|
|
|
friend Fl_Widget *make_type_browser(int,int,int,int,const char *);
|
1998-10-06 18:21:25 +00:00
|
|
|
friend class Fl_Window_Type;
|
2021-12-08 14:52:15 +00:00
|
|
|
|
|
|
|
|
virtual void setlabel(const char *) { } // virtual part of label(char*)
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
Fl_Type();
|
|
|
|
|
|
|
|
|
|
const char *name_;
|
|
|
|
|
const char *label_;
|
|
|
|
|
const char *callback_;
|
|
|
|
|
const char *user_data_;
|
|
|
|
|
const char *user_data_type_;
|
2008-09-17 22:43:15 +00:00
|
|
|
const char *comment_;
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2020-07-01 16:03:10 +00:00
|
|
|
public: // things that should not be public:
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2021-12-11 18:43:00 +00:00
|
|
|
Fl_Type *parent;
|
1998-10-06 18:21:25 +00:00
|
|
|
char new_selected; // browser highlight
|
|
|
|
|
char selected; // copied here by selection_changed()
|
2020-07-01 16:03:10 +00:00
|
|
|
char open_; // state of triangle in browser
|
1998-10-06 18:21:25 +00:00
|
|
|
char visible; // true if all parents are open
|
2020-07-01 16:03:10 +00:00
|
|
|
char rtti; // hack because I have no rtti, this is 0 for base class
|
|
|
|
|
int level; // number of parents over this
|
2021-12-11 18:43:00 +00:00
|
|
|
static Fl_Type *first, *last;
|
|
|
|
|
Fl_Type *next, *prev;
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
Fl_Type *factory;
|
|
|
|
|
const char *callback_name();
|
|
|
|
|
|
2010-11-14 15:03:57 +00:00
|
|
|
int code_position, header_position;
|
|
|
|
|
int code_position_end, header_position_end;
|
2005-11-03 20:43:19 +00:00
|
|
|
|
2009-03-27 20:05:03 +00:00
|
|
|
protected:
|
|
|
|
|
int user_defined(const char* cbname) const;
|
|
|
|
|
|
1998-10-06 18:21:25 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual ~Fl_Type();
|
2021-12-11 18:43:00 +00:00
|
|
|
virtual Fl_Type *make(Strategy strategy) = 0;
|
|
|
|
|
|
|
|
|
|
Fl_Window_Type *window();
|
|
|
|
|
Fl_Group_Type *group();
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2021-12-11 18:43:00 +00:00
|
|
|
void add(Fl_Type *parent, Strategy strategy);
|
1998-10-06 18:21:25 +00:00
|
|
|
void insert(Fl_Type *n); // insert into list before n
|
2020-07-01 16:03:10 +00:00
|
|
|
Fl_Type* remove(); // remove from list
|
1998-10-06 18:21:25 +00:00
|
|
|
void move_before(Fl_Type*); // move before a sibling
|
|
|
|
|
|
|
|
|
|
virtual const char *title(); // string for browser
|
|
|
|
|
virtual const char *type_name() = 0; // type for code output
|
2009-10-02 19:08:55 +00:00
|
|
|
virtual const char *alt_type_name() { return type_name(); } // alternate type for FLTK2 code output
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
const char *name() const {return name_;}
|
|
|
|
|
void name(const char *);
|
|
|
|
|
const char *label() const {return label_;}
|
|
|
|
|
void label(const char *);
|
|
|
|
|
const char *callback() const {return callback_;}
|
|
|
|
|
void callback(const char *);
|
|
|
|
|
const char *user_data() const {return user_data_;}
|
|
|
|
|
void user_data(const char *);
|
|
|
|
|
const char *user_data_type() const {return user_data_type_;}
|
|
|
|
|
void user_data_type(const char *);
|
2008-09-17 22:43:15 +00:00
|
|
|
const char *comment() { return comment_; }
|
|
|
|
|
void comment(const char *);
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
virtual Fl_Type* click_test(int,int) { return NULL; }
|
|
|
|
|
virtual void add_child(Fl_Type*, Fl_Type* beforethis) { }
|
|
|
|
|
virtual void move_child(Fl_Type*, Fl_Type* beforethis) { }
|
|
|
|
|
virtual void remove_child(Fl_Type*) { }
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
static Fl_Type *current; // most recently picked object
|
2021-12-11 18:43:00 +00:00
|
|
|
static Fl_Type *current_dnd;
|
|
|
|
|
|
2020-07-01 16:03:10 +00:00
|
|
|
virtual void open(); // what happens when you double-click
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
// read and write data to a saved file:
|
2016-07-18 21:12:25 +00:00
|
|
|
virtual void write();
|
1998-10-06 18:21:25 +00:00
|
|
|
virtual void write_properties();
|
|
|
|
|
virtual void read_property(const char *);
|
|
|
|
|
virtual int read_fdesign(const char*, const char*);
|
|
|
|
|
|
|
|
|
|
// write code, these are called in order:
|
|
|
|
|
virtual void write_static(); // write static stuff to .c file
|
|
|
|
|
virtual void write_code1(); // code and .h before children
|
|
|
|
|
virtual void write_code2(); // code and .h after children
|
2008-09-17 22:43:15 +00:00
|
|
|
void write_comment_h(const char *ind=""); // write the commentary text into the header file
|
|
|
|
|
void write_comment_c(const char *ind=""); // write the commentary text into the source file
|
2015-04-02 17:19:33 +00:00
|
|
|
void write_comment_inline_c(const char *ind=0L); // write the commentary text
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2005-07-08 14:12:00 +00:00
|
|
|
// live mode
|
|
|
|
|
virtual Fl_Widget *enter_live_mode(int top=0); // build wdgets needed for live mode
|
|
|
|
|
virtual void leave_live_mode(); // free allocated resources
|
|
|
|
|
virtual void copy_properties(); // copy properties from this type into a potetial live object
|
|
|
|
|
|
2000-05-16 12:26:07 +00:00
|
|
|
// get message number for I18N
|
|
|
|
|
int msgnum();
|
|
|
|
|
|
1998-10-06 18:21:25 +00:00
|
|
|
// fake rtti:
|
2021-12-08 14:52:15 +00:00
|
|
|
virtual int is_parent() const {return 0;}
|
|
|
|
|
virtual int is_widget() const {return 0;}
|
|
|
|
|
virtual int is_button() const {return 0;}
|
|
|
|
|
virtual int is_input() const {return 0;}
|
|
|
|
|
virtual int is_value_input() const {return 0;}
|
|
|
|
|
virtual int is_text_display() const {return 0;}
|
|
|
|
|
virtual int is_valuator() const {return 0;}
|
|
|
|
|
virtual int is_spinner() const {return 0;}
|
|
|
|
|
virtual int is_menu_item() const {return 0;}
|
|
|
|
|
virtual int is_menu_button() const {return 0;}
|
|
|
|
|
virtual int is_group() const {return 0;}
|
|
|
|
|
virtual int is_window() const {return 0;}
|
|
|
|
|
virtual int is_code() const {return 0;}
|
|
|
|
|
virtual int is_code_block() const {return 0;}
|
|
|
|
|
virtual int is_decl_block() const {return 0;}
|
|
|
|
|
virtual int is_comment() const {return 0;}
|
|
|
|
|
virtual int is_class() const {return 0;}
|
|
|
|
|
virtual int is_public() const {return 1;}
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2002-10-30 21:08:39 +00:00
|
|
|
virtual int pixmapID() { return 0; }
|
|
|
|
|
|
2000-02-05 09:20:46 +00:00
|
|
|
const char* class_name(const int need_nest) const;
|
2005-08-23 11:28:13 +00:00
|
|
|
const class Fl_Class_Type* is_in_class() const;
|
1998-10-06 18:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2021-12-08 14:52:15 +00:00
|
|
|
#endif // _FLUID_FL_TYPE_H
|