fl_type.h
来自「SRI international 发布的OAA框架软件」· C头文件 代码 · 共 598 行 · 第 1/2 页
H
598 行
//
// "$Id: Fl_Type.h,v 1.1.1.1 2003/06/03 22:25:40 agno Exp $"
//
// Widget type header file for the Fast Light Tool Kit (FLTK).
//
// Each object described by Fluid is one of these objects. They
// are all stored in a double-linked list.
//
// There is also a single "factory" instance of each type of this.
// The method "make()" is called on this factory to create a new
// instance of this object. It could also have a "copy()" function,
// but it was easier to implement this by using the file read/write
// that is needed to save the setup anyways.
// Copyright 1998-2002 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu.H>
#include "Fluid_Image.h"
class Fl_Type {
friend class Widget_Browser;
friend Fl_Widget *make_type_browser(int,int,int,int,const char *l=0);
friend class Fl_Window_Type;
virtual void setlabel(const char *); // virtual part of label(char*)
protected:
Fl_Type();
const char *name_;
const char *label_;
const char *callback_;
const char *user_data_;
const char *user_data_type_;
public: // things that should not be public:
Fl_Type *parent; // parent, which is previous in list
char new_selected; // browser highlight
char selected; // copied here by selection_changed()
char open_; // state of triangle in browser
char visible; // true if all parents are open
char rtti; // hack because I have no rtti, this is 0 for base class
int level; // number of parents over this
static Fl_Type *first, *last; // linked list of all objects
Fl_Type *next, *prev; // linked list of all objects
Fl_Type *factory;
const char *callback_name();
public:
virtual ~Fl_Type();
virtual Fl_Type *make() = 0;
void add(Fl_Type *parent); // add as new child
void insert(Fl_Type *n); // insert into list before n
Fl_Type* remove(); // remove from list
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
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 *);
virtual Fl_Type* click_test(int,int);
virtual void add_child(Fl_Type*, Fl_Type* beforethis);
virtual void move_child(Fl_Type*, Fl_Type* beforethis);
virtual void remove_child(Fl_Type*);
static Fl_Type *current; // most recently picked object
virtual void open(); // what happens when you double-click
// read and write data to a saved file:
void write();
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
// get message number for I18N
int msgnum();
// fake rtti:
virtual int is_parent() const;
virtual int is_widget() const;
virtual int is_button() const;
virtual int is_valuator() const;
virtual int is_menu_item() const;
virtual int is_menu_button() const;
virtual int is_group() const;
virtual int is_window() const;
virtual int is_code_block() const;
virtual int is_decl_block() const;
virtual int is_class() const;
virtual int is_public() const;
virtual int pixmapID() { return 0; }
const char* class_name(const int need_nest) const;
};
class Fl_Function_Type : public Fl_Type {
const char* return_type;
char public_, cdecl_, constructor, havewidgets;
public:
Fl_Type *make();
void write_code1();
void write_code2();
void open();
int ismain() {return name_ == 0;}
virtual const char *type_name() {return "Function";}
virtual const char *title() {
return name() ? name() : "main()";
}
int is_parent() const {return 1;}
int is_code_block() const {return 1;}
virtual int is_public() const;
int pixmapID() { return 7; }
void write_properties();
void read_property(const char *);
};
class Fl_Code_Type : public Fl_Type {
public:
Fl_Type *make();
void write_code1();
void write_code2();
void open();
virtual const char *type_name() {return "code";}
int is_code_block() const {return 0;}
int pixmapID() { return 8; }
virtual int is_public() const;
};
class Fl_CodeBlock_Type : public Fl_Type {
const char* after;
public:
Fl_Type *make();
void write_code1();
void write_code2();
void open();
virtual const char *type_name() {return "codeblock";}
int is_code_block() const {return 1;}
int is_parent() const {return 1;}
virtual int is_public() const;
int pixmapID() { return 9; }
void write_properties();
void read_property(const char *);
};
class Fl_Decl_Type : public Fl_Type {
char public_;
public:
Fl_Type *make();
void write_code1();
void write_code2();
void open();
virtual const char *type_name() {return "decl";}
void write_properties();
void read_property(const char *);
virtual int is_public() const;
int pixmapID() { return 10; }
};
class Fl_DeclBlock_Type : public Fl_Type {
const char* after;
public:
Fl_Type *make();
void write_code1();
void write_code2();
void open();
virtual const char *type_name() {return "declblock";}
void write_properties();
void read_property(const char *);
int is_parent() const {return 1;}
int is_decl_block() const {return 1;}
int pixmapID() { return 11; }
};
class Fl_Class_Type : public Fl_Type {
const char* subclass_of;
char public_;
public:
// state variables for output:
char write_public_state; // true when public: has been printed
Fl_Class_Type* parent_class; // save class if nested
//
Fl_Type *make();
void write_code1();
void write_code2();
void open();
virtual const char *type_name() {return "class";}
int is_parent() const {return 1;}
int is_decl_block() const {return 1;}
int is_class() const {return 1;}
virtual int is_public() const;
int pixmapID() { return 12; }
void write_properties();
void read_property(const char *);
// class prefix attribute access
void prefix(const char* p);
const char* prefix() const {return class_prefix;}
private:
const char* class_prefix;
};
#define NUM_EXTRA_CODE 4
class Fl_Widget_Type : public Fl_Type {
virtual Fl_Widget *widget(int,int,int,int) = 0;
virtual Fl_Widget_Type *_make() = 0; // virtual constructor
virtual void setlabel(const char *);
const char *extra_code_[NUM_EXTRA_CODE];
const char *subclass_;
const char *tooltip_;
const char *image_name_;
const char *inactive_name_;
uchar hotspot_;
protected:
void write_static();
void write_code1();
void write_widget_code();
void write_extra_code();
void write_block_close();
void write_code2();
public:
const char *xclass; // junk string, used for shortcut
Fl_Widget *o;
int public_;
Fluid_Image *image;
void setimage(Fluid_Image *);
Fluid_Image *inactive;
void setinactive(Fluid_Image *);
Fl_Widget_Type();
Fl_Type *make();
void open();
const char *extra_code(int n) const {return extra_code_[n];}
void extra_code(int n,const char *);
const char *subclass() const {return subclass_;}
void subclass(const char *);
const char *tooltip() const {return tooltip_;}
void tooltip(const char *);
const char *image_name() const {return image_name_;}
void image_name(const char *);
const char *inactive_name() const {return inactive_name_;}
void inactive_name(const char *);
uchar hotspot() const {return hotspot_;}
void hotspot(uchar v) {hotspot_ = v;}
uchar resizable() const;
void resizable(uchar v);
virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &);
virtual Fl_Menu_Item *subtypes();
virtual int is_widget() const;
virtual int is_public() const;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?