mirror of
https://github.com/fltk/fltk.git
synced 2026-03-23 15:35:11 +08:00
FLUID: emulated RTTI for all types
Complete type hierarchy in Fl_Types doc Window now derives correctly from Group Menu Items now correctly (functionally in FLUID) derived form Button Menu Buttons have a better hierarchy Fixing two possible crash bugs where Input_Choice was assumed to be a Menu_ Hoping I have not degraded the original code!
This commit is contained in:
@@ -26,6 +26,7 @@ set (CPPFILES
|
||||
Fl_Type.cxx
|
||||
Fl_Widget_Type.cxx
|
||||
Fl_Window_Type.cxx
|
||||
Fl_Button_Type.cxx
|
||||
Fluid_Image.cxx
|
||||
about_panel.cxx
|
||||
align_widget.cxx
|
||||
@@ -54,6 +55,7 @@ set (HEADERFILES
|
||||
Fl_Type.h
|
||||
Fl_Widget_Type.h
|
||||
Fl_Window_Type.h
|
||||
Fl_Button_Type.h
|
||||
Fluid_Image.h
|
||||
StyleParse.h
|
||||
about_panel.h
|
||||
|
||||
235
fluid/Fl_Button_Type.cxx
Normal file
235
fluid/Fl_Button_Type.cxx
Normal file
@@ -0,0 +1,235 @@
|
||||
//
|
||||
// Widget factory code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Type classes for most of the fltk widgets. Most of the work
|
||||
// is done by code in Fl_Widget_Type.C. Also a factory instance
|
||||
// of each of these type classes.
|
||||
//
|
||||
// This file also contains the "new" menu, which has a pointer
|
||||
// to a factory instance for every class (both the ones defined
|
||||
// here and ones in other files)
|
||||
//
|
||||
// Copyright 1998-2017 by Bill Spitzak and others.
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// https://www.fltk.org/COPYING.php
|
||||
//
|
||||
// Please see the following page on how to report bugs and issues:
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
#include "Fl_Button_Type.h"
|
||||
|
||||
#include "fluid.h"
|
||||
#include "Fl_Window_Type.h"
|
||||
#include "Fl_Group_Type.h"
|
||||
#include "Fd_Snap_Action.h"
|
||||
#include "pixmaps.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Adjuster.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Browser.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Check_Browser.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
#include <FL/Fl_Clock.H>
|
||||
#include <FL/Fl_Counter.H>
|
||||
#include <FL/Fl_Dial.H>
|
||||
#include <FL/Fl_File_Browser.H>
|
||||
#include <FL/Fl_File_Input.H>
|
||||
#include <FL/Fl_Flex.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Help_View.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Light_Button.H>
|
||||
#include <FL/Fl_Menu_Item.H>
|
||||
#include <FL/Fl_Output.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/Fl_Progress.H>
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
#include <FL/Fl_Repeat_Button.H>
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
#include <FL/Fl_Roller.H>
|
||||
#include <FL/Fl_Scrollbar.H>
|
||||
#include <FL/Fl_Simple_Terminal.H>
|
||||
#include <FL/Fl_Spinner.H>
|
||||
#include <FL/Fl_Text_Display.H>
|
||||
#include <FL/Fl_Text_Editor.H>
|
||||
#include <FL/Fl_Tree.H>
|
||||
#include <FL/Fl_Value_Slider.H>
|
||||
#include <FL/Fl_Value_Input.H>
|
||||
#include <FL/Fl_Value_Output.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include "../src/flstring.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// ---- Button Types --------------------------------------------------- MARK: -
|
||||
|
||||
|
||||
// ---- Button ----
|
||||
|
||||
static Fl_Menu_Item buttontype_menu[] = {
|
||||
{"Normal", 0, 0, (void*)0},
|
||||
{"Toggle", 0, 0, (void*)FL_TOGGLE_BUTTON},
|
||||
{"Radio", 0, 0, (void*)FL_RADIO_BUTTON},
|
||||
{0}
|
||||
};
|
||||
|
||||
Fl_Menu_Item *Fl_Button_Type::subtypes() FL_OVERRIDE {
|
||||
return buttontype_menu;
|
||||
}
|
||||
|
||||
void Fl_Button_Type::ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
|
||||
Fl_Widget *Fl_Button_Type::widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Button(x, y, w, h, "Button");
|
||||
}
|
||||
|
||||
Fl_Button_Type Fl_Button_type;
|
||||
|
||||
|
||||
// ---- Return Button ----
|
||||
|
||||
/**
|
||||
\brief The Return Button is simply a Button with the return key as a hotkey.
|
||||
*/
|
||||
class Fl_Return_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + h; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Return_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::ReturnButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Return_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Return_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Return_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Return_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
Fl_Return_Button_Type Fl_Return_Button_type;
|
||||
|
||||
|
||||
// ---- Repeat Button ----
|
||||
|
||||
/**
|
||||
\brief Handler for Fl_Repeat_Button.
|
||||
\note Even though Fl_Repeat_Button is somewhat limited compared to Fl_Button,
|
||||
and some settings may not make much sense, it is still derived from it,
|
||||
so the wrapper should be as well.
|
||||
*/
|
||||
class Fl_Repeat_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Repeat_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::RepeatButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Repeat_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Repeat_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Repeat_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Repeat_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
Fl_Repeat_Button_Type Fl_Repeat_Button_type;
|
||||
|
||||
|
||||
// ---- Light Button ----
|
||||
|
||||
/**
|
||||
\brief A handler for a toggle button with an indicator light.
|
||||
*/
|
||||
class Fl_Light_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the light
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Light_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::LightButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Light_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Light_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Light_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Light_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
Fl_Light_Button_Type Fl_Light_Button_type;
|
||||
|
||||
|
||||
// ---- Check Button ----
|
||||
|
||||
/**
|
||||
\brief Manage buttons with a check mark on its left.
|
||||
*/
|
||||
class Fl_Check_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Check_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::CheckButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Check_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Check_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Check_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Check_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
Fl_Check_Button_Type Fl_Check_Button_type;
|
||||
|
||||
|
||||
// ---- Round Button ----
|
||||
|
||||
/**
|
||||
\brief Manage buttons with a round indicator on its left.
|
||||
*/
|
||||
class Fl_Round_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Round_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::RadioButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Round_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Round_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Round_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Round_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
Fl_Round_Button_Type Fl_Round_Button_type;
|
||||
|
||||
43
fluid/Fl_Button_Type.h
Normal file
43
fluid/Fl_Button_Type.h
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Widget type header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// https://www.fltk.org/COPYING.php
|
||||
//
|
||||
// Please see the following page on how to report bugs and issues:
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
#ifndef _FLUID_FACTORY_H
|
||||
#define _FLUID_FACTORY_H
|
||||
|
||||
#include "Fl_Widget_Type.h"
|
||||
|
||||
/**
|
||||
\brief A handler for the simple push button and a base class for all other buttons.
|
||||
*/
|
||||
class Fl_Button_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE;
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Button"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h);
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Button_Type(); }
|
||||
int is_button() const FL_OVERRIDE { return 1; }
|
||||
ID id() const FL_OVERRIDE { return ID_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
extern Fl_Button_Type Fl_Button_type;
|
||||
|
||||
|
||||
#endif // _FLUID_FACTORY_H
|
||||
@@ -42,7 +42,9 @@ const char *c_check(const char *c, int type = 0);
|
||||
|
||||
// ---- Fl_Function_Type declaration
|
||||
|
||||
class Fl_Function_Type : public Fl_Type {
|
||||
class Fl_Function_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
const char* return_type;
|
||||
char public_, cdecl_, constructor, havewidgets;
|
||||
|
||||
@@ -62,6 +64,7 @@ public:
|
||||
int is_code_block() const FL_OVERRIDE {return 1;}
|
||||
int is_public() const FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Function; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Function) ? true : super::is_a(inID); }
|
||||
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
int has_signature(const char *, const char*) const;
|
||||
@@ -69,7 +72,9 @@ public:
|
||||
|
||||
// ---- Fl_Code_Type declaration
|
||||
|
||||
class Fl_Code_Type : public Fl_Type {
|
||||
class Fl_Code_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
ExternalCodeEditor editor_;
|
||||
int cursor_position_;
|
||||
int code_input_scroll_row;
|
||||
@@ -86,6 +91,7 @@ public:
|
||||
int is_code_block() const FL_OVERRIDE {return 0;}
|
||||
int is_code() const FL_OVERRIDE {return 1;}
|
||||
ID id() const FL_OVERRIDE { return ID_Code; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Code) ? true : super::is_a(inID); }
|
||||
int is_public() const FL_OVERRIDE { return -1; }
|
||||
int is_editing();
|
||||
int reap_editor();
|
||||
@@ -94,7 +100,9 @@ public:
|
||||
|
||||
// ---- Fl_CodeBlock_Type declaration
|
||||
|
||||
class Fl_CodeBlock_Type : public Fl_Type {
|
||||
class Fl_CodeBlock_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
const char* after;
|
||||
|
||||
public:
|
||||
@@ -109,13 +117,16 @@ public:
|
||||
int is_parent() const FL_OVERRIDE {return 1;}
|
||||
int is_public() const FL_OVERRIDE { return -1; }
|
||||
ID id() const FL_OVERRIDE { return ID_CodeBlock; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_CodeBlock) ? true : super::is_a(inID); }
|
||||
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
};
|
||||
|
||||
// ---- Fl_Decl_Type declaration
|
||||
|
||||
class Fl_Decl_Type : public Fl_Type {
|
||||
class Fl_Decl_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
|
||||
protected:
|
||||
char public_;
|
||||
@@ -132,11 +143,14 @@ public:
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
int is_public() const FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Decl; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Decl) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
// ---- Fl_Data_Type declaration
|
||||
|
||||
class Fl_Data_Type : public Fl_Decl_Type {
|
||||
class Fl_Data_Type : public Fl_Decl_Type
|
||||
{
|
||||
typedef Fl_Decl_Type super;
|
||||
const char *filename_;
|
||||
int text_mode_;
|
||||
|
||||
@@ -151,11 +165,14 @@ public:
|
||||
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Data; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Data) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
// ---- Fl_DeclBlock_Type declaration
|
||||
|
||||
class Fl_DeclBlock_Type : public Fl_Type {
|
||||
class Fl_DeclBlock_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
const char* after;
|
||||
char public_;
|
||||
|
||||
@@ -173,11 +190,14 @@ public:
|
||||
int is_decl_block() const FL_OVERRIDE {return 1;}
|
||||
int is_public() const FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_DeclBlock; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_DeclBlock) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
// ---- Fl_Comment_Type declaration
|
||||
|
||||
class Fl_Comment_Type : public Fl_Type {
|
||||
class Fl_Comment_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
char in_c_, in_h_, style_;
|
||||
char title_buf[64];
|
||||
|
||||
@@ -194,11 +214,14 @@ public:
|
||||
int is_public() const FL_OVERRIDE { return 1; }
|
||||
int is_comment() const FL_OVERRIDE { return 1; }
|
||||
ID id() const FL_OVERRIDE { return ID_Comment; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Comment) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
// ---- Fl_Class_Type declaration
|
||||
|
||||
class Fl_Class_Type : public Fl_Type {
|
||||
class Fl_Class_Type : public Fl_Type
|
||||
{
|
||||
typedef Fl_Type super;
|
||||
const char* subclass_of;
|
||||
char public_;
|
||||
const char* class_prefix;
|
||||
@@ -220,6 +243,7 @@ public:
|
||||
int is_class() const FL_OVERRIDE {return 1;}
|
||||
int is_public() const FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Class; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Class) ? true : super::is_a(inID); }
|
||||
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ public:
|
||||
igroup(int X,int Y,int W,int H) : Fl_Group(X,Y,W,H) {Fl_Group::current(0);}
|
||||
};
|
||||
|
||||
class Fl_Group_Type : public Fl_Widget_Type {
|
||||
class Fl_Group_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Group";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::Group";}
|
||||
@@ -52,6 +54,7 @@ public:
|
||||
int is_parent() const FL_OVERRIDE {return 1;}
|
||||
int is_group() const FL_OVERRIDE {return 1;}
|
||||
ID id() const FL_OVERRIDE { return ID_Group; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Group) ? true : super::is_a(inID); }
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void leave_live_mode() FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
@@ -62,13 +65,16 @@ public:
|
||||
extern const char pack_type_name[];
|
||||
extern Fl_Menu_Item pack_type_menu[];
|
||||
|
||||
class Fl_Pack_Type : public Fl_Group_Type {
|
||||
class Fl_Pack_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE {return pack_type_menu;}
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return pack_type_name;}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::PackedGroup";}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Pack_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Pack; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Pack) ? true : super::is_a(inID); }
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
};
|
||||
@@ -78,7 +84,9 @@ public:
|
||||
extern const char flex_type_name[];
|
||||
extern Fl_Menu_Item flex_type_menu[];
|
||||
|
||||
class Fl_Flex_Type : public Fl_Group_Type {
|
||||
class Fl_Flex_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE {return flex_type_menu;}
|
||||
int fixedSizeTupleSize; /* number of pairs in array */
|
||||
int *fixedSizeTuple; /* [ index, size, index2, size2, ... ] */
|
||||
@@ -91,6 +99,7 @@ public:
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||
Fl_Flex *g = new Fl_Flex(X,Y,W,H); Fl_Group::current(0); return g;}
|
||||
ID id() const FL_OVERRIDE { return ID_Flex; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Flex) ? true : super::is_a(inID); }
|
||||
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
|
||||
void read_property(Fd_Project_Reader &f, const char *) FL_OVERRIDE;
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
@@ -137,7 +146,9 @@ public:
|
||||
itabs(int X,int Y,int W,int H) : Fl_Tabs(X,Y,W,H) {}
|
||||
};
|
||||
|
||||
class Fl_Tabs_Type : public Fl_Group_Type {
|
||||
class Fl_Tabs_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return tabs_type_name;}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::TabGroup";}
|
||||
@@ -148,6 +159,7 @@ public:
|
||||
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE;
|
||||
void remove_child(Fl_Type*) FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Tabs; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Tabs) ? true : super::is_a(inID); }
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
int is_tabs() const FL_OVERRIDE {return 1;}
|
||||
};
|
||||
@@ -157,13 +169,16 @@ public:
|
||||
extern const char scroll_type_name[];
|
||||
extern Fl_Menu_Item scroll_type_menu[];
|
||||
|
||||
class Fl_Scroll_Type : public Fl_Group_Type {
|
||||
class Fl_Scroll_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE {return scroll_type_menu;}
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return scroll_type_name;}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::ScrollGroup";}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Scroll_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Scroll; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Scroll) ? true : super::is_a(inID); }
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
int is_scroll() const FL_OVERRIDE { return 1; }
|
||||
@@ -173,12 +188,15 @@ public:
|
||||
|
||||
extern const char tile_type_name[];
|
||||
|
||||
class Fl_Tile_Type : public Fl_Group_Type {
|
||||
class Fl_Tile_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return tile_type_name;}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::TileGroup";}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Tile_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Tile; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Tile) ? true : super::is_a(inID); }
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
};
|
||||
|
||||
@@ -193,7 +211,9 @@ public:
|
||||
|
||||
extern const char wizard_type_name[];
|
||||
|
||||
class Fl_Wizard_Type : public Fl_Group_Type {
|
||||
class Fl_Wizard_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE {return wizard_type_name;}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::WizardGroup";}
|
||||
@@ -201,6 +221,7 @@ public:
|
||||
iwizard *g = new iwizard(X,Y,W,H); Fl_Group::current(0); return g;}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Wizard_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Wizard; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Wizard) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
#endif // _FLUID_FL_GROUP_TYPE_H
|
||||
|
||||
@@ -158,7 +158,7 @@ Fl_Type *Fl_Menu_Item_Type::make(Strategy strategy) {
|
||||
if ( (force_parent && q->is_menu_item()) || !q->is_parent()) p = p->parent;
|
||||
}
|
||||
force_parent = 0;
|
||||
if (!p || !(p->is_menu_button() || (p->is_menu_item() && p->is_parent()))) {
|
||||
if (!p || !(p->is_a(ID_Menu_Manager_) || (p->is_menu_item() && p->is_parent()))) {
|
||||
fl_message("Please select a menu to add to");
|
||||
return 0;
|
||||
}
|
||||
@@ -532,7 +532,7 @@ void Fl_Menu_Item_Type::write_code2(Fd_Code_Writer&) {}
|
||||
// children. An actual array of Fl_Menu_Items is kept parallel
|
||||
// with the child objects and updated as they change.
|
||||
|
||||
void Fl_Menu_Type::build_menu() {
|
||||
void Fl_Menu_Base_Type::build_menu() {
|
||||
Fl_Menu_* w = (Fl_Menu_*)o;
|
||||
// count how many Fl_Menu_Item structures needed:
|
||||
int n = 0;
|
||||
@@ -596,7 +596,7 @@ void Fl_Menu_Type::build_menu() {
|
||||
o->redraw();
|
||||
}
|
||||
|
||||
Fl_Type* Fl_Menu_Type::click_test(int, int) {
|
||||
Fl_Type* Fl_Menu_Base_Type::click_test(int, int) {
|
||||
if (selected) return 0; // let user move the widget
|
||||
Fl_Menu_* w = (Fl_Menu_*)o;
|
||||
if (!menusize) return 0;
|
||||
@@ -615,7 +615,7 @@ Fl_Type* Fl_Menu_Type::click_test(int, int) {
|
||||
return this;
|
||||
}
|
||||
|
||||
void Fl_Menu_Type::write_code2(Fd_Code_Writer& f) {
|
||||
void Fl_Menu_Manager_Type::write_code2(Fd_Code_Writer& f) {
|
||||
if (next && next->is_menu_item()) {
|
||||
f.write_c("%s%s->menu(%s);\n", f.indent(), name() ? name() : "o",
|
||||
f.unique_id(this, "menu", name(), label()));
|
||||
@@ -623,7 +623,7 @@ void Fl_Menu_Type::write_code2(Fd_Code_Writer& f) {
|
||||
Fl_Widget_Type::write_code2(f);
|
||||
}
|
||||
|
||||
void Fl_Menu_Type::copy_properties() {
|
||||
void Fl_Menu_Base_Type::copy_properties() {
|
||||
Fl_Widget_Type::copy_properties();
|
||||
Fl_Menu_ *s = (Fl_Menu_*)o, *d = (Fl_Menu_*)live_widget;
|
||||
d->menu(s->menu());
|
||||
|
||||
@@ -21,17 +21,28 @@
|
||||
#ifndef _FLUID_FL_MENU_TYPE_H
|
||||
#define _FLUID_FL_MENU_TYPE_H
|
||||
|
||||
#include "Fl_Widget_Type.h"
|
||||
#include "Fl_Button_Type.h"
|
||||
|
||||
#include <FL/Fl_Choice.H>
|
||||
#include <FL/Fl_Menu_.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
#include <FL/Fl_Input_Choice.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Menu_Bar.H>
|
||||
|
||||
extern Fl_Menu_Item dummymenu[];
|
||||
extern Fl_Menu_Item button_type_menu[];
|
||||
extern Fl_Menu_Item menu_item_type_menu[];
|
||||
|
||||
class Fl_Menu_Item_Type : public Fl_Widget_Type { // FIXME: hmmmmm
|
||||
/**
|
||||
\brief Manage all types on menu items.
|
||||
Deriving Fl_Menu_Item_Type from Fl_Button_Type is intentional. For the purpose
|
||||
of editing, a Menu Item is implemented with `o` pointing to an Fl_Button for
|
||||
holding all properties.
|
||||
*/
|
||||
class Fl_Menu_Item_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
Fl_Menu_Item* subtypes() FL_OVERRIDE {return menu_item_type_menu;}
|
||||
const char* type_name() FL_OVERRIDE {return "MenuItem";}
|
||||
@@ -48,23 +59,45 @@ public:
|
||||
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_Item; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Item) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
class Fl_Radio_Menu_Item_Type : public Fl_Menu_Item_Type {
|
||||
/**
|
||||
\brief Manage Radio style Menu Items.
|
||||
*/
|
||||
class Fl_Radio_Menu_Item_Type : public Fl_Menu_Item_Type
|
||||
{
|
||||
typedef Fl_Menu_Item_Type super;
|
||||
public:
|
||||
const char* type_name() FL_OVERRIDE {return "RadioMenuItem";}
|
||||
Fl_Type* make(Strategy strategy) FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Radio_Menu_Item; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Radio_Menu_Item) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
class Fl_Checkbox_Menu_Item_Type : public Fl_Menu_Item_Type {
|
||||
/**
|
||||
\brief Manage Checkbox style Menu Items.
|
||||
*/
|
||||
class Fl_Checkbox_Menu_Item_Type : public Fl_Menu_Item_Type
|
||||
{
|
||||
typedef Fl_Menu_Item_Type super;
|
||||
public:
|
||||
const char* type_name() FL_OVERRIDE {return "CheckMenuItem";}
|
||||
Fl_Type* make(Strategy strategy) FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Checkbox_Menu_Item; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Checkbox_Menu_Item) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
class Fl_Submenu_Type : public Fl_Menu_Item_Type {
|
||||
/**
|
||||
\brief Manage Submenu style Menu Items.
|
||||
Submenu Items are simply buttons just like all other menu items, but they
|
||||
can also hold a pointer to a list of submenus, or have a flag set that
|
||||
allows submenus to follow in the current array. As buttons, they can
|
||||
be clicked by the user, and they will call their callback, if one is set.
|
||||
*/
|
||||
class Fl_Submenu_Type : public Fl_Menu_Item_Type
|
||||
{
|
||||
typedef Fl_Menu_Item_Type super;
|
||||
public:
|
||||
Fl_Menu_Item* subtypes() FL_OVERRIDE {return 0;}
|
||||
const char* type_name() FL_OVERRIDE {return "Submenu";}
|
||||
@@ -78,86 +111,43 @@ public:
|
||||
void move_child(Fl_Type*a, Fl_Type*b) FL_OVERRIDE {parent->move_child(a,b);}
|
||||
void remove_child(Fl_Type*a) FL_OVERRIDE {parent->remove_child(a);}
|
||||
ID id() const FL_OVERRIDE { return ID_Submenu; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Submenu) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
class Fl_Menu_Type : public Fl_Widget_Type {
|
||||
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE {
|
||||
Fl_Menu_ *myo = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o);
|
||||
switch (w) {
|
||||
case 4:
|
||||
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
||||
case 1: myo->textfont(f); break;
|
||||
case 2: myo->textsize(s); break;
|
||||
case 3: myo->textcolor(c); break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Base class for all widgets that can have a pulldown menu attached.
|
||||
Widgets with this type can be derived from Fl_Menu_ or from
|
||||
Fl_Group (Fl_Input_Choice).
|
||||
*/
|
||||
class Fl_Menu_Manager_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
int is_menu_button() const FL_OVERRIDE {return 1;}
|
||||
int is_parent() const FL_OVERRIDE {return 1;}
|
||||
int menusize;
|
||||
virtual void build_menu();
|
||||
Fl_Menu_Type() : Fl_Widget_Type() {menusize = 0;}
|
||||
~Fl_Menu_Type() {
|
||||
if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Menu_*)o)->menu());
|
||||
}
|
||||
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE {build_menu();}
|
||||
void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE {build_menu();}
|
||||
void remove_child(Fl_Type*) FL_OVERRIDE {build_menu();}
|
||||
Fl_Type* click_test(int x, int y) FL_OVERRIDE;
|
||||
virtual void build_menu() = 0;
|
||||
Fl_Menu_Manager_Type() : Fl_Widget_Type() {menusize = 0;}
|
||||
void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE { build_menu(); }
|
||||
void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE { build_menu(); }
|
||||
void remove_child(Fl_Type*) FL_OVERRIDE { build_menu();}
|
||||
Fl_Type* click_test(int x, int y) FL_OVERRIDE = 0;
|
||||
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_; }
|
||||
void copy_properties() FL_OVERRIDE = 0;
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_Manager_; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Manager_) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
extern Fl_Menu_Item button_type_menu[];
|
||||
|
||||
class Fl_Menu_Button_Type : public Fl_Menu_Type {
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE {return button_type_menu;}
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
Fl_Widget_Type::ideal_size(w, h);
|
||||
w += 2 * ((o->labelsize() - 3) & ~1) + o->labelsize() - 4;
|
||||
h = (h / 5) * 5;
|
||||
if (h < 15) h = 15;
|
||||
if (w < (15 + h)) w = 15 + h;
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Menu_Button";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuButton";}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||
return new Fl_Menu_Button(X,Y,W,H,"menu");}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Button_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_Button; }
|
||||
};
|
||||
|
||||
extern Fl_Menu_Item dummymenu[];
|
||||
|
||||
#include <FL/Fl_Choice.H>
|
||||
class Fl_Choice_Type : public Fl_Menu_Type {
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
Fl_Widget_Type::ideal_size(w, h);
|
||||
int w1 = o->h() - Fl::box_dh(o->box());
|
||||
if (w1 > 20) w1 = 20;
|
||||
w1 = (w1 - 4) / 3;
|
||||
if (w1 < 1) w1 = 1;
|
||||
w += 2 * w1 + o->labelsize() - 4;
|
||||
h = (h / 5) * 5;
|
||||
if (h < 15) h = 15;
|
||||
if (w < (15 + h)) w = 15 + h;
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Choice";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::Choice";}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||
Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:");
|
||||
myo->menu(dummymenu);
|
||||
return myo;
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Choice_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Choice; }
|
||||
};
|
||||
|
||||
class Fl_Input_Choice_Type : public Fl_Menu_Type { // FIXME: Composite: Fl_Group
|
||||
/**
|
||||
\brief Manage the composite widget Input Choice.
|
||||
\note Input Choice is a composite window, so `o` will be pointing to a widget
|
||||
derived from Fl_Group. All menu related methods from Fl_Menu_Trait_Type must
|
||||
be virtual and must be reimplemented here (click_test, build_menu, textstuff).
|
||||
*/
|
||||
class Fl_Input_Choice_Type : public Fl_Menu_Manager_Type
|
||||
{
|
||||
typedef Fl_Menu_Manager_Type super;
|
||||
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE {
|
||||
Fl_Input_Choice *myo = (Fl_Input_Choice*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o);
|
||||
switch (w) {
|
||||
@@ -180,6 +170,9 @@ public:
|
||||
if (h < 15) h = 15;
|
||||
if (w < (15 + h)) w = 15 + h;
|
||||
}
|
||||
~Fl_Input_Choice_Type() {
|
||||
if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Input_Choice*)o)->menu());
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Input_Choice";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::ComboBox";}
|
||||
Fl_Type* click_test(int,int) FL_OVERRIDE;
|
||||
@@ -192,10 +185,103 @@ public:
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Input_Choice_Type();}
|
||||
void build_menu() FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Input_Choice; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Input_Choice) ? true : super::is_a(inID); }
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
};
|
||||
|
||||
class Fl_Menu_Bar_Type : public Fl_Menu_Type {
|
||||
/**
|
||||
\brief Base class to handle widgets that are derived from Fl_Menu_.
|
||||
*/
|
||||
class Fl_Menu_Base_Type : public Fl_Menu_Manager_Type
|
||||
{
|
||||
typedef Fl_Menu_Manager_Type super;
|
||||
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE {
|
||||
Fl_Menu_ *myo = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o);
|
||||
switch (w) {
|
||||
case 4:
|
||||
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
||||
case 1: myo->textfont(f); break;
|
||||
case 2: myo->textsize(s); break;
|
||||
case 3: myo->textcolor(c); break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
public:
|
||||
int is_parent() const FL_OVERRIDE {return 1;}
|
||||
void build_menu() FL_OVERRIDE;
|
||||
~Fl_Menu_Base_Type() {
|
||||
if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Menu_*)o)->menu());
|
||||
}
|
||||
Fl_Type* click_test(int x, int y) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
extern Fl_Menu_Item button_type_menu[];
|
||||
|
||||
/**
|
||||
\brief Makae Menu Button widgets.
|
||||
*/
|
||||
class Fl_Menu_Button_Type : public Fl_Menu_Base_Type
|
||||
{
|
||||
typedef Fl_Menu_Base_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE {return button_type_menu;}
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
Fl_Widget_Type::ideal_size(w, h);
|
||||
w += 2 * ((o->labelsize() - 3) & ~1) + o->labelsize() - 4;
|
||||
h = (h / 5) * 5;
|
||||
if (h < 15) h = 15;
|
||||
if (w < (15 + h)) w = 15 + h;
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Menu_Button";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuButton";}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||
return new Fl_Menu_Button(X,Y,W,H,"menu");}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Button_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\brief Manage Choice type menu widgets.
|
||||
*/
|
||||
class Fl_Choice_Type : public Fl_Menu_Base_Type
|
||||
{
|
||||
typedef Fl_Menu_Base_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
Fl_Widget_Type::ideal_size(w, h);
|
||||
int w1 = o->h() - Fl::box_dh(o->box());
|
||||
if (w1 > 20) w1 = 20;
|
||||
w1 = (w1 - 4) / 3;
|
||||
if (w1 < 1) w1 = 1;
|
||||
w += 2 * w1 + o->labelsize() - 4;
|
||||
h = (h / 5) * 5;
|
||||
if (h < 15) h = 15;
|
||||
if (w < (15 + h)) w = 15 + h;
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE {return "Fl_Choice";}
|
||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::Choice";}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||
Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:");
|
||||
myo->menu(dummymenu);
|
||||
return myo;
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Choice_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Choice; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Choice) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\brief Manage Menubar widgets.
|
||||
*/
|
||||
class Fl_Menu_Bar_Type : public Fl_Menu_Base_Type
|
||||
{
|
||||
typedef Fl_Menu_Base_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
w = o->window()->w();
|
||||
@@ -207,6 +293,7 @@ public:
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {return new Fl_Menu_Bar(X,Y,W,H);}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Bar_Type();}
|
||||
ID id() const FL_OVERRIDE { return ID_Menu_Bar; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Menu_Bar) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -18,17 +18,79 @@
|
||||
/// \{
|
||||
|
||||
/** \class Fl_Type
|
||||
Each object described by Fluid is one of these objects. They
|
||||
are all stored in a double-linked list.
|
||||
Each object described by Fluid is one of these objects. They
|
||||
are all stored in a double-linked list.
|
||||
|
||||
The "type" of the object is covered by the virtual functions.
|
||||
There will probably be a lot of these virtual functions.
|
||||
The "type" of the object is covered by the virtual functions.
|
||||
There will probably be a lot of these virtual functions.
|
||||
|
||||
The type browser is also a list of these objects, but they
|
||||
are "factory" instances, not "real" ones. These objects exist
|
||||
only so the "make" method can be called on them. They are
|
||||
not in the linked list and are not written to files or
|
||||
copied or otherwise examined.
|
||||
|
||||
The Fl_Type inheritance is currently:
|
||||
--+-- Fl_Type
|
||||
+-- Fl_Function_Type
|
||||
+-- Fl_Code_Type
|
||||
+-- Fl_CodeBlock_Type
|
||||
+-+ Fl_Decl_Type
|
||||
| +-- Fl_Data
|
||||
+-- Fl_DeclBlock_Type
|
||||
+-- Fl_Comment_Type
|
||||
+-- Fl_Class_Type
|
||||
+-+ Fl_Widget_Type, 'o' points to a class derived from Fl_Widget
|
||||
+-+ Fl_Browser_Base_Type, 'o' is Fl_Browser
|
||||
| +-+ Fl_Browser
|
||||
| | +-- Fl_File_Browser
|
||||
| +-- Fl_Check_Browser
|
||||
+-- Fl_Tree_Type
|
||||
+-- Fl_Help_View_Type
|
||||
+-+ Fl_Valuator_Type, 'o' is Fl_Valuator_
|
||||
| +-- Fl_Counter_Type
|
||||
| +-- Fl_Adjuster_Type
|
||||
| +-- Fl_Dial_Type
|
||||
| +-- Fl_Roller_Type
|
||||
| +-- Fl_Slider_Type
|
||||
| +-- Fl_Value_Input_Type
|
||||
| +-- Fl_Value_Output_Type
|
||||
+-+ Fl_Input_Type
|
||||
| +-- Fl_Output_Type
|
||||
+-+ Fl_Text_Display_Type
|
||||
| +-- Fl_Text_Editor+Type
|
||||
| +-- Fl_Simple_Terminal_Type
|
||||
+-- Fl_Box_Type
|
||||
+-- Fl_Clock_Type
|
||||
+-- Fl_Progress_Type
|
||||
+-- Fl_Spinner_Type
|
||||
+-+ Fl_Group_Type
|
||||
| +-- Fl_Pack_Type
|
||||
| +-- Fl_Flex_Type
|
||||
| +-- Fl_Table_Type
|
||||
| +-- Fl_Tabs_Type
|
||||
| +-- Fl_Scroll_Type
|
||||
| +-- Fl_Tile_Type
|
||||
| +-- Fl_Wizard_Type
|
||||
| +-+ Fl_Window_Type
|
||||
| +-- Fl_Widget_Class_Type
|
||||
+-+ Fl_Menu_Manager_Type, 'o' is based on Fl_Widget
|
||||
| +-+ Fl_Menu_Base_Type, 'o' is based on Fl_Menu_
|
||||
| | +-- Fl_Menu_Button_Type
|
||||
| | +-- Fl_Choice_Type
|
||||
| | +-- Fl_Menu_Bar_Type
|
||||
| +-- Fl_Input_Choice_Type, 'o' is based on Fl_Input_Choice which is Fl_Group
|
||||
+-+ Fl_Button_Type
|
||||
+-- Fl_Return_Button_Type
|
||||
+-- Fl_Repeat_Button_Type
|
||||
+-- Fl_Light_Button_Type
|
||||
+-- Fl_Check_Button_Type
|
||||
+-- Fl_Round_Button_Type
|
||||
+-+ Fl_Menu_Item_Type, 'o' is derived from Fl_Button in FLUID
|
||||
+-- Fl_Radio_Menu_Item_Type
|
||||
+-- Fl_Checkbox_Menu_Item_Type
|
||||
+-- Fl_Submenu_Item_Type
|
||||
|
||||
The type browser is also a list of these objects, but they
|
||||
are "factory" instances, not "real" ones. These objects exist
|
||||
only so the "make" method can be called on them. They are
|
||||
not in the linked list and are not written to files or
|
||||
copied or otherwise examined.
|
||||
*/
|
||||
|
||||
#include "Fl_Type.h"
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
|
||||
enum ID {
|
||||
// administrative
|
||||
ID_Base_, ID_Widget_, ID_Menu_, ID_Browser_, ID_Valuator,
|
||||
ID_Base_, ID_Widget_, ID_Menu_Manager_, ID_Menu_, ID_Browser_, ID_Valuator_,
|
||||
// non-widget
|
||||
ID_Function, ID_Code, ID_CodeBlock,
|
||||
ID_Decl, ID_DeclBlock, ID_Class,
|
||||
@@ -187,7 +187,6 @@ public:
|
||||
/// TODO: Misnamed: This is true if the widget is a button or a menu item with button functionality
|
||||
virtual int is_button() 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_tabs() const {return 0;}
|
||||
virtual int is_scroll() const {return 0;}
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void down_box_cb(Fl_Choice* i, void *v) {
|
||||
n = ((Fl_Button*)(current_widget->o))->down_box();
|
||||
else if (current_widget->id() == Fl_Type::ID_Input_Choice)
|
||||
n = ((Fl_Input_Choice*)(current_widget->o))->down_box();
|
||||
else if (current_widget->is_menu_button())
|
||||
else if (current_widget->is_a(Fl_Type::ID_Menu_Manager_))
|
||||
n = ((Fl_Menu_*)(current_widget->o))->down_box();
|
||||
else {
|
||||
i->deactivate(); return;
|
||||
@@ -1074,7 +1074,7 @@ void down_box_cb(Fl_Choice* i, void *v) {
|
||||
} else if (o->id() == Fl_Type::ID_Input_Choice) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
((Fl_Input_Choice*)(q->o))->down_box((Fl_Boxtype)n);
|
||||
} else if (o->is_menu_button()) {
|
||||
} else if (o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
((Fl_Menu_*)(q->o))->down_box((Fl_Boxtype)n);
|
||||
}
|
||||
@@ -2037,7 +2037,7 @@ void slider_size_cb(Fl_Value_Input* i, void* v) {
|
||||
|
||||
void min_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator_)) {
|
||||
i->activate();
|
||||
i->value(((Fl_Valuator*)(current_widget->o))->minimum());
|
||||
} else if (current_widget->is_a(Fl_Type::ID_Spinner)) {
|
||||
@@ -2054,7 +2054,7 @@ void min_cb(Fl_Value_Input* i, void* v) {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_widget()) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
if (q->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (q->is_a(Fl_Type::ID_Valuator_)) {
|
||||
((Fl_Valuator*)(q->o))->minimum(n);
|
||||
q->o->redraw();
|
||||
mod = 1;
|
||||
@@ -2071,7 +2071,7 @@ void min_cb(Fl_Value_Input* i, void* v) {
|
||||
|
||||
void max_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator_)) {
|
||||
i->activate();
|
||||
i->value(((Fl_Valuator*)(current_widget->o))->maximum());
|
||||
} else if (current_widget->is_a(Fl_Type::ID_Spinner)) {
|
||||
@@ -2088,7 +2088,7 @@ void max_cb(Fl_Value_Input* i, void* v) {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_widget()) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
if (q->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (q->is_a(Fl_Type::ID_Valuator_)) {
|
||||
((Fl_Valuator*)(q->o))->maximum(n);
|
||||
q->o->redraw();
|
||||
mod = 1;
|
||||
@@ -2105,7 +2105,7 @@ void max_cb(Fl_Value_Input* i, void* v) {
|
||||
|
||||
void step_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator_)) {
|
||||
i->activate();
|
||||
i->value(((Fl_Valuator*)(current_widget->o))->step());
|
||||
} else if (current_widget->is_a(Fl_Type::ID_Spinner)) {
|
||||
@@ -2122,7 +2122,7 @@ void step_cb(Fl_Value_Input* i, void* v) {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_widget()) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
if (q->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (q->is_a(Fl_Type::ID_Valuator_)) {
|
||||
((Fl_Valuator*)(q->o))->step(n);
|
||||
q->o->redraw();
|
||||
mod = 1;
|
||||
@@ -2139,7 +2139,7 @@ void step_cb(Fl_Value_Input* i, void* v) {
|
||||
|
||||
void value_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (current_widget->is_a(Fl_Type::ID_Valuator_)) {
|
||||
i->activate();
|
||||
i->value(((Fl_Valuator*)(current_widget->o))->value());
|
||||
} else if (current_widget->is_button()) {
|
||||
@@ -2157,7 +2157,7 @@ void value_cb(Fl_Value_Input* i, void* v) {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_widget()) {
|
||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||
if (q->is_a(Fl_Type::ID_Valuator)) {
|
||||
if (q->is_a(Fl_Type::ID_Valuator_)) {
|
||||
((Fl_Valuator*)(q->o))->value(n);
|
||||
mod = 1;
|
||||
} else if (q->is_button()) {
|
||||
@@ -3041,7 +3041,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
|
||||
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
|
||||
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
|
||||
boxname(b->down_box()));
|
||||
} else if (is_menu_button()) {
|
||||
} else if (is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
Fl_Menu_* b = (Fl_Menu_*)o;
|
||||
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
|
||||
boxname(b->down_box()));
|
||||
@@ -3061,7 +3061,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
|
||||
f.write_c("%s%s->labelsize(%d);\n", f.indent(), var, o->labelsize());
|
||||
if (o->labelcolor() != tplate->labelcolor() || subclass())
|
||||
write_color(f, "labelcolor", o->labelcolor());
|
||||
if (is_a(ID_Valuator)) {
|
||||
if (is_a(ID_Valuator_)) {
|
||||
Fl_Valuator* v = (Fl_Valuator*)o;
|
||||
Fl_Valuator* t = (Fl_Valuator*)(tplate);
|
||||
if (v->minimum()!=t->minimum())
|
||||
@@ -3217,7 +3217,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
|
||||
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
|
||||
if (b->down_box()) {
|
||||
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
|
||||
} else if (is_menu_button()) {
|
||||
} else if (is_a(Fl_Type::ID_Menu_)) {
|
||||
Fl_Menu_* b = (Fl_Menu_*)o;
|
||||
if (b->down_box()) {
|
||||
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
|
||||
@@ -3240,7 +3240,7 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
|
||||
f.write_string("align %d", o->align());
|
||||
if (o->when() != tplate->when())
|
||||
f.write_string("when %d", o->when());
|
||||
if (is_a(ID_Valuator)) {
|
||||
if (is_a(ID_Valuator_)) {
|
||||
Fl_Valuator* v = (Fl_Valuator*)o;
|
||||
Fl_Valuator* t = (Fl_Valuator*)(tplate);
|
||||
if (v->minimum()!=t->minimum()) f.write_string("minimum %g",v->minimum());
|
||||
@@ -3351,7 +3351,7 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
|
||||
if (x == ZERO_ENTRY) x = 0;
|
||||
((Fl_Input_Choice*)o)->down_box((Fl_Boxtype)x);
|
||||
}
|
||||
} else if (is_menu_button() && !strcmp(c,"down_box")) {
|
||||
} else if (is_a(Fl_Type::ID_Menu_) && !strcmp(c,"down_box")) {
|
||||
const char* value = f.read_word();
|
||||
if ((x = boxnumber(value))) {
|
||||
if (x == ZERO_ENTRY) x = 0;
|
||||
@@ -3398,21 +3398,19 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
|
||||
} else if (!strcmp(c,"when")) {
|
||||
if (sscanf(f.read_word(),"%d",&x) == 1) o->when(x);
|
||||
} else if (!strcmp(c,"minimum")) {
|
||||
if (is_a(ID_Valuator)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Valuator_)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Spinner)) ((Fl_Spinner*)o)->minimum(strtod(f.read_word(),0));
|
||||
} else if (!strcmp(c,"maximum")) {
|
||||
if (is_a(ID_Valuator)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Valuator_)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Spinner)) ((Fl_Spinner*)o)->maximum(strtod(f.read_word(),0));
|
||||
} else if (!strcmp(c,"step")) {
|
||||
if (is_a(ID_Valuator)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Valuator_)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Spinner)) ((Fl_Spinner*)o)->step(strtod(f.read_word(),0));
|
||||
} else if (!strcmp(c,"value")) {
|
||||
if (is_a(ID_Valuator)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Valuator_)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),0));
|
||||
if (is_a(ID_Spinner)) ((Fl_Spinner*)o)->value(strtod(f.read_word(),0));
|
||||
} else if ( (!strcmp(c,"slider_size") || !strcmp(c,"size")) && is_a(ID_Slider)) {
|
||||
((Fl_Slider*)o)->slider_size(strtod(f.read_word(),0));
|
||||
} else if ( (!strcmp(c,"slider_size") || !strcmp(c,"size")) ) {
|
||||
int x = is_a(ID_Slider);
|
||||
} else if (!strcmp(c,"textfont")) {
|
||||
if (sscanf(f.read_word(),"%d",&x) == 1) {ft=(Fl_Font)x; textstuff(1,ft,s,cc);}
|
||||
} else if (!strcmp(c,"textsize")) {
|
||||
@@ -3658,7 +3656,7 @@ void Fl_Widget_Type::copy_properties() {
|
||||
}
|
||||
|
||||
// copy all attributes specific to Fl_Valuator and derived classes
|
||||
if (is_a(ID_Valuator)) {
|
||||
if (is_a(ID_Valuator_)) {
|
||||
Fl_Valuator* d = (Fl_Valuator*)live_widget, *s = (Fl_Valuator*)o;
|
||||
d->minimum(s->minimum());
|
||||
d->maximum(s->maximum());
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
#ifndef _FLUID_FL_WINDOW_TYPE_H
|
||||
#define _FLUID_FL_WINDOW_TYPE_H
|
||||
|
||||
#include "Fl_Widget_Type.h"
|
||||
#include "Fl_Group_Type.h"
|
||||
|
||||
class Fl_Widget_Class_Type;
|
||||
|
||||
extern Fl_Menu_Item window_type_menu[];
|
||||
extern Fl_Widget_Class_Type *current_widget_class;
|
||||
|
||||
void toggle_overlays(Fl_Widget *,void *);
|
||||
void toggle_guides(Fl_Widget *,void *);
|
||||
void toggle_restricted(Fl_Widget *,void *);
|
||||
@@ -43,7 +44,9 @@ enum {
|
||||
FD_BOX = 32 // user creates a new selection box
|
||||
};
|
||||
|
||||
class Fl_Window_Type : public Fl_Widget_Type { // FIXME: Fl_Group
|
||||
class Fl_Window_Type : public Fl_Group_Type
|
||||
{
|
||||
typedef Fl_Group_Type super;
|
||||
protected:
|
||||
|
||||
Fl_Menu_Item* subtypes() FL_OVERRIDE {return window_type_menu;}
|
||||
@@ -71,6 +74,7 @@ protected:
|
||||
int recalc; // set by fix_overlay()
|
||||
void moveallchildren();
|
||||
ID id() const FL_OVERRIDE { return ID_Window; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Window) ? true : super::is_a(inID); }
|
||||
void open_();
|
||||
|
||||
public:
|
||||
@@ -122,7 +126,9 @@ public:
|
||||
static int popupx, popupy;
|
||||
};
|
||||
|
||||
class Fl_Widget_Class_Type : private Fl_Window_Type {
|
||||
class Fl_Widget_Class_Type : private Fl_Window_Type
|
||||
{
|
||||
typedef Fl_Window_Type super;
|
||||
protected:
|
||||
Fl_Menu_Item* subtypes() FL_OVERRIDE {return 0;}
|
||||
|
||||
@@ -143,6 +149,7 @@ public:
|
||||
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
|
||||
const char *type_name() FL_OVERRIDE {return "widget_class";}
|
||||
ID id() const FL_OVERRIDE { return ID_Widget_Class; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Widget_Class) ? true : super::is_a(inID); }
|
||||
int is_parent() const FL_OVERRIDE {return 1;}
|
||||
int is_code_block() const FL_OVERRIDE {return 1;}
|
||||
int is_decl_block() const FL_OVERRIDE {return 1;}
|
||||
|
||||
@@ -60,7 +60,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(left, w->y(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -95,7 +95,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize((center2-w->w())/2, w->y(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -127,7 +127,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(right-w->w(), w->y(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -158,7 +158,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(w->x(), top, w->w(), w->h());
|
||||
} else {
|
||||
@@ -193,7 +193,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(w->x(), (center2-w->h())/2, w->w(), w->h());
|
||||
} else {
|
||||
@@ -225,7 +225,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize( w->x(), bot-w->h(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -265,7 +265,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(left+wsum+wdt*cnt/n, w->y(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -307,7 +307,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(w->x(), top+hsum+hgt*cnt/n, w->w(), w->h());
|
||||
} else {
|
||||
@@ -342,7 +342,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(w->x(), w->y(), wdt, w->h());
|
||||
} else {
|
||||
@@ -373,7 +373,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize( w->x(), w->y(), w->w(), hgt);
|
||||
} else {
|
||||
@@ -406,7 +406,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
}
|
||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize( w->x(), w->y(), wdt, hgt);
|
||||
} else {
|
||||
@@ -434,7 +434,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
else center2 = 2*p->x()+p->w();
|
||||
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button() && !o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize((center2-w->w())/2, w->y(), w->w(), w->h());
|
||||
} else {
|
||||
@@ -461,7 +461,7 @@ void align_widget_cb(Fl_Widget*, long how)
|
||||
else center2 = 2*p->y()+p->h();
|
||||
|
||||
if (o->next && o->next->level > o->level && !o->next->selected &&
|
||||
!o->is_menu_button()) {
|
||||
!o->is_a(Fl_Type::ID_Menu_Manager_)) {
|
||||
// When resizing a group, make sure we also move the children...
|
||||
((igroup *)w)->full_resize(w->x(), (center2-w->h())/2, w->w(), w->h());
|
||||
} else {
|
||||
|
||||
@@ -72,268 +72,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
// ---- Other Types --------------------------------------------------- MARK: -
|
||||
|
||||
|
||||
// ---- Box ----
|
||||
|
||||
/**
|
||||
\brief Manage box widgets.
|
||||
Ideal size is set to 100x100, snapped to layout.
|
||||
*/
|
||||
class Fl_Box_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
w = 100; h = 100;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Box"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Widget"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Box(x, y, w, h, "label");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Box_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Box; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Box) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Box_Type Fl_Box_type;
|
||||
|
||||
|
||||
// ---- Clock ----
|
||||
|
||||
/**
|
||||
\brief Manage Clock widgets.
|
||||
Ideal size is set to 80x80 snapped to layout.
|
||||
*/
|
||||
class Fl_Clock_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
w = 80; h = 80;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Clock"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Clock"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Clock(x, y, w, h);
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Clock_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Clock; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Clock) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Clock_Type Fl_Clock_type;
|
||||
|
||||
|
||||
// ---- Progress ----
|
||||
|
||||
/**
|
||||
\brief Manage a Progress widget.
|
||||
Ideal size is set to match the label font and label text width times 3.
|
||||
\note minimum, maximum, and value must be set via extra code fields.
|
||||
*/
|
||||
class Fl_Progress_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 12;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Progress"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::ProgressBar"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
Fl_Progress *myo = new Fl_Progress(x, y, w, h, "label");
|
||||
myo->value(50);
|
||||
return myo;
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Progress_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Progress; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Progress) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Progress_Type Fl_Progress_type;
|
||||
|
||||
|
||||
|
||||
// ---- Button Types --------------------------------------------------- MARK: -
|
||||
|
||||
|
||||
// ---- Button ----
|
||||
|
||||
static Fl_Menu_Item buttontype_menu[] = {
|
||||
{"Normal", 0, 0, (void*)0},
|
||||
{"Toggle", 0, 0, (void*)FL_TOGGLE_BUTTON},
|
||||
{"Radio", 0, 0, (void*)FL_RADIO_BUTTON},
|
||||
{0}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A handler for the simple push button and a base class for all other buttons.
|
||||
*/
|
||||
class Fl_Button_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
Fl_Menu_Item *subtypes() FL_OVERRIDE { return buttontype_menu; }
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Button"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Button_Type(); }
|
||||
int is_button() const FL_OVERRIDE { return 1; }
|
||||
ID id() const FL_OVERRIDE { return ID_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Button_Type Fl_Button_type;
|
||||
|
||||
|
||||
// ---- Return Button ----
|
||||
|
||||
/**
|
||||
\brief The Return Button is simply a Button with the return key as a hotkey.
|
||||
*/
|
||||
class Fl_Return_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + h; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Return_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::ReturnButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Return_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Return_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Return_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Return_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Return_Button_Type Fl_Return_Button_type;
|
||||
|
||||
|
||||
// ---- Repeat Button ----
|
||||
|
||||
/**
|
||||
\brief Handler for Fl_Repeat_Button.
|
||||
\note Even though Fl_Repeat_Button is somewhat limited compared to Fl_Button,
|
||||
and some settings may not make much sense, it is still derived from it,
|
||||
so the wrapper should be as well.
|
||||
*/
|
||||
class Fl_Repeat_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Repeat_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::RepeatButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Repeat_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Repeat_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Repeat_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Repeat_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Repeat_Button_Type Fl_Repeat_Button_type;
|
||||
|
||||
|
||||
// ---- Light Button ----
|
||||
|
||||
/**
|
||||
\brief A handler for a toggle button with an indicator light.
|
||||
*/
|
||||
class Fl_Light_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the light
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Light_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::LightButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Light_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Light_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Light_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Light_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Light_Button_Type Fl_Light_Button_type;
|
||||
|
||||
|
||||
// ---- Check Button ----
|
||||
|
||||
/**
|
||||
\brief Manage buttons with a check mark on its left.
|
||||
*/
|
||||
class Fl_Check_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Check_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::CheckButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Check_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Check_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Check_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Check_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Check_Button_Type Fl_Check_Button_type;
|
||||
|
||||
|
||||
// ---- Round Button ----
|
||||
|
||||
/**
|
||||
\brief Manage buttons with a round indicator on its left.
|
||||
*/
|
||||
class Fl_Round_Button_Type : public Fl_Button_Type
|
||||
{
|
||||
typedef Fl_Button_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 4 + 8 + layout->labelsize; // make room for the symbol
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Round_Button"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::RadioButton"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Round_Button(x, y, w, h, "Button");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Round_Button_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Round_Button; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Round_Button) ? true : super::is_a(inID); }
|
||||
};
|
||||
static Fl_Round_Button_Type Fl_Round_Button_type;
|
||||
|
||||
|
||||
|
||||
// ---- Browser Types -------------------------------------------------- MARK: -
|
||||
|
||||
|
||||
@@ -586,8 +324,8 @@ public:
|
||||
return new Fl_Slider(x, y, w, h, "Valuator");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Valuator_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Valuator; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Valuator) ? true : super::is_a(inID); }
|
||||
ID id() const FL_OVERRIDE { return ID_Valuator_; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Valuator_) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Valuator_Type Fl_Valuator_type;
|
||||
@@ -1149,6 +887,90 @@ static Fl_Simple_Terminal_Type Fl_Simple_Terminal_type;
|
||||
// ---- Other ---------------------------------------------------------- MARK: -
|
||||
|
||||
|
||||
// ---- Box ----
|
||||
|
||||
/**
|
||||
\brief Manage box widgets.
|
||||
Ideal size is set to 100x100, snapped to layout.
|
||||
*/
|
||||
class Fl_Box_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
w = 100; h = 100;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Box"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Widget"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Box(x, y, w, h, "label");
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Box_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Box; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Box) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Box_Type Fl_Box_type;
|
||||
|
||||
|
||||
// ---- Clock ----
|
||||
|
||||
/**
|
||||
\brief Manage Clock widgets.
|
||||
Ideal size is set to 80x80 snapped to layout.
|
||||
*/
|
||||
class Fl_Clock_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
w = 80; h = 80;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Clock"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::Clock"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
return new Fl_Clock(x, y, w, h);
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Clock_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Clock; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Clock) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Clock_Type Fl_Clock_type;
|
||||
|
||||
|
||||
// ---- Progress ----
|
||||
|
||||
/**
|
||||
\brief Manage a Progress widget.
|
||||
Ideal size is set to match the label font and label text width times 3.
|
||||
\note minimum, maximum, and value must be set via extra code fields.
|
||||
*/
|
||||
class Fl_Progress_Type : public Fl_Widget_Type
|
||||
{
|
||||
typedef Fl_Widget_Type super;
|
||||
public:
|
||||
void ideal_size(int &w, int &h) FL_OVERRIDE {
|
||||
h = layout->labelsize + 8;
|
||||
w = layout->labelsize * 12;
|
||||
Fd_Snap_Action::better_size(w, h);
|
||||
}
|
||||
const char *type_name() FL_OVERRIDE { return "Fl_Progress"; }
|
||||
const char *alt_type_name() FL_OVERRIDE { return "fltk::ProgressBar"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
Fl_Progress *myo = new Fl_Progress(x, y, w, h, "label");
|
||||
myo->value(50);
|
||||
return myo;
|
||||
}
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Progress_Type(); }
|
||||
ID id() const FL_OVERRIDE { return ID_Progress; }
|
||||
bool is_a(ID inID) FL_OVERRIDE { return (inID==ID_Progress) ? true : super::is_a(inID); }
|
||||
};
|
||||
|
||||
static Fl_Progress_Type Fl_Progress_type;
|
||||
|
||||
// ---- Spinner ----
|
||||
|
||||
static Fl_Menu_Item spinner_type_menu[] = {
|
||||
@@ -1226,6 +1048,13 @@ extern class Fl_Radio_Menu_Item_Type Fl_Radio_Menu_Item_type;
|
||||
extern class Fl_Submenu_Type Fl_Submenu_type;
|
||||
extern class Fl_Wizard_Type Fl_Wizard_type;
|
||||
|
||||
extern class Fl_Button_Type Fl_Button_type;
|
||||
extern class Fl_Return_Button_Type Fl_Return_Button_type;
|
||||
extern class Fl_Light_Button_Type Fl_Light_Button_type;
|
||||
extern class Fl_Check_Button_Type Fl_Check_Button_type;
|
||||
extern class Fl_Repeat_Button_Type Fl_Repeat_Button_type;
|
||||
extern class Fl_Round_Button_Type Fl_Round_Button_type;
|
||||
|
||||
extern void select(Fl_Type *,int);
|
||||
extern void select_only(Fl_Type *);
|
||||
|
||||
@@ -1351,7 +1180,7 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
|
||||
|
||||
if ((t->parent && t->parent->is_flex())) {
|
||||
// Do not resize or layout the widget. Flex will need the widget size.
|
||||
} else if (wt->id() == Fl_Type::ID_Menu_Bar) {
|
||||
} else if (wt->is_a(Fl_Type::ID_Menu_Bar)) {
|
||||
// Move and resize the menubar across the top of the window...
|
||||
wt->o->resize(0, 0, w, h);
|
||||
} else {
|
||||
|
||||
@@ -420,7 +420,7 @@ int Fd_Project_Reader::read_project(const char *filename, int merge, Strategy st
|
||||
Fl_Type::current = 0;
|
||||
// Force menu items to be rebuilt...
|
||||
for (o = Fl_Type::first; o; o = o->next)
|
||||
if (o->is_menu_button())
|
||||
if (o->is_a(Fl_Type::ID_Menu_Manager_))
|
||||
o->add_child(0,0);
|
||||
for (o = Fl_Type::first; o; o = o->next)
|
||||
if (o->selected) {
|
||||
|
||||
Reference in New Issue
Block a user