mirror of
https://github.com/fltk/fltk.git
synced 2026-02-06 00:01:57 +08:00
Added Fl_Tree source code, demo files, and documentation. Thanks, Greg!
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6934 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
398
FL/Fl_Table.H
398
FL/Fl_Table.H
File diff suppressed because it is too large
Load Diff
@@ -98,7 +98,7 @@ private:
|
||||
void size(int count) {
|
||||
if ( count != _size ) {
|
||||
arr = (char*)realloc(arr, count * sizeof(char));
|
||||
_size = count;
|
||||
_size = count;
|
||||
}
|
||||
}
|
||||
char pop_back() {
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
}
|
||||
};
|
||||
CharVector _rowselect; // selection flag for each row
|
||||
|
||||
|
||||
// handle() state variables.
|
||||
// Put here instead of local statics in handle(), so more
|
||||
// than one instance can exist without crosstalk between.
|
||||
@@ -126,22 +126,22 @@ private:
|
||||
int _last_y; // last event's Y position
|
||||
int _last_push_x; // last PUSH event's X position
|
||||
int _last_push_y; // last PUSH event's Y position
|
||||
|
||||
|
||||
TableRowSelectMode _selectmode;
|
||||
|
||||
|
||||
protected:
|
||||
int handle(int event);
|
||||
int find_cell(TableContext context, // find cell's x/y/w/h given r/c
|
||||
int R, int C, int &X, int &Y, int &W, int &H) {
|
||||
int R, int C, int &X, int &Y, int &W, int &H) {
|
||||
return(Fl_Table::find_cell(context, R, C, X, Y, W, H));
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
The constructor for the Fl_Table_Row.
|
||||
This creates an empty table with no rows or columns,
|
||||
with headers and row/column resize behavior disabled.
|
||||
*/
|
||||
*/
|
||||
Fl_Table_Row(int X, int Y, int W, int H, const char *l=0) : Fl_Table(X,Y,W,H,l) {
|
||||
_dragging_select = 0;
|
||||
_last_row = -1;
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
- \p Fl_Table_Row::SELECT_NONE - No selection allowed
|
||||
- \p Fl_Table_Row::SELECT_SINGLE - Only single rows can be selected
|
||||
- \p Fl_Table_Row::SELECT_MULTI - Multiple rows can be selected
|
||||
*/
|
||||
*/
|
||||
void type(TableRowSelectMode val); // set selection mode
|
||||
|
||||
TableRowSelectMode type() const { // get selection mode
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
of 'flag'. 0=deselected, 1=select, 2=toggle existing state.
|
||||
*/
|
||||
int select_row(int row, int flag=1); // select state for row: flag:0=off, 1=on, 2=toggle
|
||||
// returns: 0=no change, 1=changed, -1=range err
|
||||
// returns: 0=no change, 1=changed, -1=range err
|
||||
|
||||
/**
|
||||
This convenience function changes the selection state
|
||||
|
||||
647
FL/Fl_Tree.H
Normal file
647
FL/Fl_Tree.H
Normal file
File diff suppressed because it is too large
Load Diff
291
FL/Fl_Tree_Item.H
Normal file
291
FL/Fl_Tree_Item.H
Normal file
@@ -0,0 +1,291 @@
|
||||
#ifndef FL_TREE_ITEM_H
|
||||
#define FL_TREE_ITEM_H
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
#include <FL/Fl_Tree_Item_Array.H>
|
||||
#include <FL/Fl_Tree_Prefs.H>
|
||||
|
||||
//////////////////////
|
||||
// FL/Fl_Tree_Item.H
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for Fl_Tree_Item
|
||||
///
|
||||
|
||||
/// \brief Tree item
|
||||
///
|
||||
/// This class is a single tree item, and manages all of the item's attributes.
|
||||
/// Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item.
|
||||
///
|
||||
/// Fl_Tree_Item is hierarchical; it dynamically manages an Fl_Tree_Item_Array of children
|
||||
/// that are themselves instances of Fl_Tree_Item. Each item can have zero or more children.
|
||||
/// When an item has children, close() and open() can be used to hide or show them.
|
||||
///
|
||||
/// Items have their own attributes; font size, face, color.
|
||||
/// Items maintain their own hierarchy of children.
|
||||
///
|
||||
/// When you make changes to items, you'll need to tell the tree to redraw()
|
||||
/// for the changes to show up.
|
||||
///
|
||||
class Fl_Tree_Item {
|
||||
const char *_label; // label (memory managed)
|
||||
int _labelfont; // label's font face
|
||||
int _labelsize; // label's font size
|
||||
Fl_Color _labelfgcolor; // label's fg color
|
||||
Fl_Color _labelbgcolor; // label's bg color
|
||||
char _open; // item is open?
|
||||
char _visible; // item is visible?
|
||||
char _active; // item activated?
|
||||
char _selected; // item selected?
|
||||
int _xywh[4]; // xywh of this widget (if visible)
|
||||
int _collapse_xywh[4]; // xywh of collapse icon (if any)
|
||||
int _label_xywh[4]; // xywh of label
|
||||
Fl_Widget *_widget; // item's label widget (optional)
|
||||
Fl_Pixmap *_usericon; // item's user-specific icon (optional)
|
||||
Fl_Tree_Item_Array _children; // array of child items
|
||||
Fl_Tree_Item *_parent; // parent item (=0 if root)
|
||||
protected:
|
||||
void show_widgets();
|
||||
void hide_widgets();
|
||||
void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs);
|
||||
void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
|
||||
public:
|
||||
Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR
|
||||
~Fl_Tree_Item(); // DTOR
|
||||
Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
|
||||
void draw(int X, int &Y, int W, Fl_Widget *tree, const Fl_Tree_Prefs &prefs, int lastchild=1);
|
||||
void show_self(const char *indent = "") const;
|
||||
void label(const char *val);
|
||||
const char *label() const;
|
||||
|
||||
/// Set item's label font face.
|
||||
void labelfont(int val) {
|
||||
_labelfont = val;
|
||||
}
|
||||
/// Get item's label font face.
|
||||
int labelfont() const {
|
||||
return(_labelfont);
|
||||
}
|
||||
/// Set item's label font size.
|
||||
void labelsize(int val) {
|
||||
_labelsize = val;
|
||||
}
|
||||
/// Get item's label font size.
|
||||
int labelsize() const {
|
||||
return(_labelsize);
|
||||
}
|
||||
/// Set item's label foreground text color.
|
||||
void labelfgcolor(Fl_Color val) {
|
||||
_labelfgcolor = val;
|
||||
}
|
||||
/// Set item's label text color.
|
||||
void labelcolor(Fl_Color val) {
|
||||
_labelfgcolor = val;
|
||||
}
|
||||
/// Return item's label text color.
|
||||
Fl_Color labelcolor() const {
|
||||
return(_labelfgcolor);
|
||||
}
|
||||
/// Return item's label foreground text color.
|
||||
Fl_Color labelfgcolor() const {
|
||||
return(_labelfgcolor);
|
||||
}
|
||||
/// Set item's label background color.
|
||||
void labelbgcolor(Fl_Color val) {
|
||||
_labelbgcolor = val;
|
||||
}
|
||||
/// Return item's background text color.
|
||||
Fl_Color labelbgcolor() const {
|
||||
return(_labelbgcolor);
|
||||
}
|
||||
/// Assign an FLTK widget to this item.
|
||||
void widget(Fl_Widget *val) {
|
||||
_widget = val;
|
||||
}
|
||||
/// Return FLTK widget assigned to this item.
|
||||
Fl_Widget *widget() const {
|
||||
return(_widget);
|
||||
}
|
||||
/// Return the number of children this item has.
|
||||
int children() const {
|
||||
return(_children.total());
|
||||
}
|
||||
/// Return the child item for the given 'index'.
|
||||
Fl_Tree_Item *child(int index) {
|
||||
return(_children[index]);
|
||||
}
|
||||
/// Return the const child item for the given 'index'.
|
||||
const Fl_Tree_Item *child(int t) const;
|
||||
/// See if this item has children.
|
||||
int has_children() const {
|
||||
return(children());
|
||||
}
|
||||
int find_child(const char *name);
|
||||
int find_child(Fl_Tree_Item *item);
|
||||
int remove_child(Fl_Tree_Item *item);
|
||||
int remove_child(const char *new_label);
|
||||
void clear_children();
|
||||
void swap_children(int ax, int bx);
|
||||
int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
|
||||
const Fl_Tree_Item *find_item(char **arr) const;
|
||||
Fl_Tree_Item *find_item(char **arr);
|
||||
//////////////////
|
||||
// Adding items
|
||||
//////////////////
|
||||
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, const char *new_label);
|
||||
Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, char **arr);
|
||||
Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
|
||||
Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
|
||||
int depth() const;
|
||||
Fl_Tree_Item *prev();
|
||||
Fl_Tree_Item *next();
|
||||
|
||||
/// Return the parent for this item.
|
||||
Fl_Tree_Item *parent() {
|
||||
return(_parent);
|
||||
}
|
||||
/// Return the const parent for this item.
|
||||
const Fl_Tree_Item *parent() const {
|
||||
return(_parent);
|
||||
}
|
||||
/// Set the parent for this item.
|
||||
/// Should only be used by Fl_Tree's internals.
|
||||
///
|
||||
void parent(Fl_Tree_Item *val) {
|
||||
_parent = val;
|
||||
}
|
||||
//////////////////
|
||||
// State
|
||||
//////////////////
|
||||
void open();
|
||||
void close();
|
||||
/// See if the item is 'open'.
|
||||
int is_open() const {
|
||||
return(_open?1:0);
|
||||
}
|
||||
/// See if the item is 'closed'.
|
||||
int is_close() const {
|
||||
return(_open?0:1);
|
||||
}
|
||||
/// Toggle the item's open/closed state.
|
||||
void open_toggle() {
|
||||
_open?close():open();
|
||||
}
|
||||
/// Change the item's selection state to the optionally specified 'val'.
|
||||
/// If 'val' is not specified, the item will be selected.
|
||||
///
|
||||
void select(int val=1) {
|
||||
_selected = val;
|
||||
}
|
||||
/// Toggle the item's selection state.
|
||||
void select_toggle() {
|
||||
if ( is_selected() ) {
|
||||
deselect(); // deselect if selected
|
||||
} else {
|
||||
select(); // select if deselected
|
||||
}
|
||||
}
|
||||
/// Disable the item's selection state.
|
||||
void deselect() {
|
||||
_selected = 0;
|
||||
}
|
||||
/// Deselect self and all children
|
||||
/// Returns count of how many items were in the 'selected' state,
|
||||
/// ie. how many items were "changed".
|
||||
///
|
||||
int deselect_all() {
|
||||
int count = 0;
|
||||
if ( is_selected() ) {
|
||||
deselect();
|
||||
++count;
|
||||
}
|
||||
for ( int t=0; t<children(); t++ ) {
|
||||
count += child(t)->deselect_all();
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
/// See if the item is selected.
|
||||
char is_selected() const {
|
||||
return(_selected);
|
||||
}
|
||||
/// Change the item's activation state to the optionally specified 'val'.
|
||||
///
|
||||
/// When deactivated, the item will be 'grayed out'; the callback()
|
||||
/// won't be invoked if the user clicks on the label. If the item
|
||||
/// has a widget() associated with the item, its activation state
|
||||
/// will be changed as well.
|
||||
///
|
||||
/// If 'val' is not specified, the item will be activated.
|
||||
///
|
||||
void activate(int val=1) {
|
||||
_active = val;
|
||||
if ( _widget && val != (int)_widget->active() ) {
|
||||
if ( val ) {
|
||||
_widget->activate();
|
||||
} else {
|
||||
_widget->deactivate();
|
||||
}
|
||||
_widget->redraw();
|
||||
}
|
||||
}
|
||||
/// Deactivate the item; the callback() won't be invoked when clicked.
|
||||
/// Same as activate(0)
|
||||
///
|
||||
void deactivate() {
|
||||
activate(0);
|
||||
}
|
||||
/// See if the item is activated.
|
||||
char is_activated() const {
|
||||
return(_active);
|
||||
}
|
||||
/// See if the item is activated.
|
||||
char is_active() const {
|
||||
return(_active);
|
||||
}
|
||||
/// Set the user icon's pixmap. '0' will disable.
|
||||
void usericon(Fl_Pixmap *val) {
|
||||
_usericon = val;
|
||||
}
|
||||
/// Get the user icon. Returns '0' if disabled.
|
||||
Fl_Pixmap *usericon() const {
|
||||
return(_usericon);
|
||||
}
|
||||
//////////////////
|
||||
// Events
|
||||
//////////////////
|
||||
const Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs) const;
|
||||
Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs);
|
||||
int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
|
||||
int event_on_label(const Fl_Tree_Prefs &prefs) const;
|
||||
/// Is this item the root of the tree?
|
||||
int is_root() const {
|
||||
return(_parent==0?1:0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /*FL_TREE_ITEM_H*/
|
||||
80
FL/Fl_Tree_Item_Array.H
Normal file
80
FL/Fl_Tree_Item_Array.H
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef _FL_TREE_ITEM_ARRAY_H
|
||||
#define _FL_TREE_ITEM_ARRAY_H
|
||||
|
||||
class Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
|
||||
// or doxygen will not document our class..
|
||||
|
||||
//////////////////////
|
||||
// FL/Fl_Tree_Item_Array.H
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file defines a class that manages an array of Fl_Tree_Item pointers.
|
||||
///
|
||||
|
||||
/// \brief Manages an array of Fl_Tree_Item pointers.
|
||||
///
|
||||
/// Because FLTK 1.x.x. has mandated that templates and STL not be used,
|
||||
/// we use this class to dynamically manage the arrays.
|
||||
///
|
||||
/// None of the methods do range checking on index values; the caller
|
||||
/// must be sure that index values are within the range 0<index<total()
|
||||
/// (unless otherwise noted).
|
||||
///
|
||||
|
||||
class Fl_Tree_Item_Array {
|
||||
Fl_Tree_Item **_items; // items array
|
||||
int _total; // #items in array
|
||||
int _size; // #items *allocated* for array
|
||||
int _chunksize; // #items to enlarge mem allocation
|
||||
void enlarge(int count);
|
||||
public:
|
||||
Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
|
||||
~Fl_Tree_Item_Array(); // DTOR
|
||||
Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR
|
||||
/// Return the item and index \p i.
|
||||
Fl_Tree_Item *operator[](int i) {
|
||||
return(_items[i]);
|
||||
}
|
||||
/// Const version of operator[](int i)
|
||||
const Fl_Tree_Item *operator[](int i) const {
|
||||
return(_items[i]);
|
||||
}
|
||||
/// Return the total items in the array, or 0 if empty.
|
||||
int total() const {
|
||||
return(_total);
|
||||
}
|
||||
/// Swap the two items at index positions \p ax and \p bx.
|
||||
void swap(int ax, int bx) {
|
||||
Fl_Tree_Item *asave = _items[ax];
|
||||
_items[ax] = _items[bx];
|
||||
_items[bx] = asave;
|
||||
}
|
||||
void clear();
|
||||
void add(Fl_Tree_Item *val);
|
||||
void insert(int pos, Fl_Tree_Item *new_item);
|
||||
void remove(int index);
|
||||
int remove(Fl_Tree_Item *item);
|
||||
};
|
||||
|
||||
#endif /*_FL_TREE_ITEM_ARRAY_H*/
|
||||
353
FL/Fl_Tree_Prefs.H
Normal file
353
FL/Fl_Tree_Prefs.H
Normal file
@@ -0,0 +1,353 @@
|
||||
#ifndef FL_TREE_PREFS_H
|
||||
#define FL_TREE_PREFS_H
|
||||
|
||||
//////////////////////
|
||||
// FL/Fl_Tree_Prefs.H
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for Fl_Tree's preferences.
|
||||
///
|
||||
/// \code
|
||||
/// Fl_Tree_Prefs
|
||||
/// :
|
||||
/// .....:.......
|
||||
/// : :
|
||||
/// Fl_Tree :
|
||||
/// |_____ Fl_Tree_Item
|
||||
///
|
||||
/// \endcode
|
||||
///
|
||||
|
||||
/// \class Fl_Tree_Prefs
|
||||
/// \brief Tree widget's preferences.
|
||||
|
||||
/// \enum Fl_Tree_Sort
|
||||
/// Sort order options for items added to the tree
|
||||
///
|
||||
enum Fl_Tree_Sort {
|
||||
FL_TREE_SORT_NONE=0, ///< No sorting; items are added in the order defined (default).
|
||||
FL_TREE_SORT_ASCENDING=1, ///< Add items in ascending sort order.
|
||||
FL_TREE_SORT_DESCENDING=2 ///< Add items in descending sort order.
|
||||
};
|
||||
|
||||
/// \enum Fl_Tree_Connector
|
||||
/// Defines the style of connection lines between items.
|
||||
///
|
||||
enum Fl_Tree_Connector {
|
||||
FL_TREE_CONNECTOR_NONE=0, ///< Use no lines connecting items
|
||||
FL_TREE_CONNECTOR_DOTTED=1, ///< Use dotted lines connecting items (default)
|
||||
FL_TREE_CONNECTOR_SOLID=2 ///< Use solid lines connecting items
|
||||
};
|
||||
|
||||
/// \enum Fl_Tree_Select
|
||||
/// Tree selection style.
|
||||
///
|
||||
enum Fl_Tree_Select {
|
||||
FL_TREE_SELECT_NONE=0, ///< Nothing selected when items are clicked
|
||||
FL_TREE_SELECT_SINGLE, ///< Single item selected when item is clicked (default)
|
||||
FL_TREE_SELECT_MULTI ///< Multiple items can be selected by clicking with
|
||||
///< SHIFT or CTRL or mouse drags.
|
||||
};
|
||||
|
||||
/// \class Fl_Tree_Prefs
|
||||
///
|
||||
/// \brief Fl_Tree's Preferences class.
|
||||
///
|
||||
/// This class manages the Fl_Tree's defaults.
|
||||
/// You should probably be using the methods in Fl_Tree
|
||||
/// instead of trying to accessing tree's preferences settings directly.
|
||||
///
|
||||
class Fl_Tree_Prefs {
|
||||
int _labelfont; // label's font face
|
||||
int _labelsize; // label's font size
|
||||
int _margintop; // --
|
||||
int _marginleft; // |- tree's margins
|
||||
//int _marginright; // |
|
||||
//int _marginbottom; // --
|
||||
int _openchild_marginbottom; // extra space below an open child tree
|
||||
int _usericonmarginleft; // space to left of user icon (if any)
|
||||
int _labelmarginleft; // space to left of label
|
||||
int _connectorwidth; // connector width (right of open/close icon)
|
||||
int _linespacing; // vertical space between lines
|
||||
// Colors
|
||||
Fl_Color _fgcolor; // label's foreground color
|
||||
Fl_Color _bgcolor; // background color
|
||||
Fl_Color _selectcolor; // selection color
|
||||
Fl_Color _inactivecolor; // inactive color
|
||||
Fl_Color _connectorcolor; // connector dotted line color
|
||||
Fl_Tree_Connector _connectorstyle; // connector line style
|
||||
Fl_Pixmap *_openpixmap; // the 'open' icon [+]
|
||||
Fl_Pixmap *_closepixmap; // the 'close' icon [-]
|
||||
Fl_Pixmap *_userpixmap; // user's own icon
|
||||
char _showcollapse; // 1=show collapse icons, 0=don't
|
||||
char _showroot; // show the root item as part of the tree
|
||||
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
|
||||
Fl_Boxtype _selectbox; // selection box type
|
||||
Fl_Tree_Select _selectmode; // selection mode
|
||||
public:
|
||||
Fl_Tree_Prefs();
|
||||
|
||||
////////////////////////////
|
||||
// Labels
|
||||
////////////////////////////
|
||||
/// Return the label's font.
|
||||
inline int labelfont() const {
|
||||
return(_labelfont);
|
||||
}
|
||||
/// Set the label's font to \p val.
|
||||
inline void labelfont(int val) {
|
||||
_labelfont = val;
|
||||
}
|
||||
/// Return the label's size in pixels.
|
||||
inline int labelsize() const {
|
||||
return(_labelsize);
|
||||
}
|
||||
/// Set the label's size in pixels to \p val.
|
||||
inline void labelsize(int val) {
|
||||
_labelsize = val;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Margins
|
||||
////////////////////////////
|
||||
/// Get the left margin's value in pixels
|
||||
inline int marginleft() const {
|
||||
return(_marginleft);
|
||||
}
|
||||
/// Set the left margin's value in pixels
|
||||
inline void marginleft(int val) {
|
||||
_marginleft = val;
|
||||
}
|
||||
/// Get the top margin's value in pixels
|
||||
inline int margintop() const {
|
||||
return(_margintop);
|
||||
}
|
||||
/// Set the top margin's value in pixels
|
||||
inline void margintop(int val) {
|
||||
_margintop = val;
|
||||
}
|
||||
/// Get the margin below an open child in pixels
|
||||
inline int openchild_marginbottom() const {
|
||||
return(_openchild_marginbottom);
|
||||
}
|
||||
/// Set the margin below an open child in pixels
|
||||
inline void openchild_marginbottom(int val) {
|
||||
_openchild_marginbottom = val;
|
||||
}
|
||||
|
||||
/****** NOT IMPLEMENTED
|
||||
inline int marginright() const {
|
||||
return(_marginright);
|
||||
}
|
||||
inline void marginright(int val) {
|
||||
_marginright = val;
|
||||
}
|
||||
inline int marginbottom() const {
|
||||
return(_marginbottom);
|
||||
}
|
||||
inline void marginbottom(int val) {
|
||||
_marginbottom = val;
|
||||
}
|
||||
*******/
|
||||
|
||||
/// Get the user icon's left margin value in pixels
|
||||
inline int usericonmarginleft() const {
|
||||
return(_usericonmarginleft);
|
||||
}
|
||||
/// Set the user icon's left margin value in pixels
|
||||
inline void usericonmarginleft(int val) {
|
||||
_usericonmarginleft = val;
|
||||
}
|
||||
/// Get the label's left margin value in pixels
|
||||
inline int labelmarginleft() const {
|
||||
return(_labelmarginleft);
|
||||
}
|
||||
/// Set the label's left margin value in pixels
|
||||
inline void labelmarginleft(int val) {
|
||||
_labelmarginleft = val;
|
||||
}
|
||||
/// Get the line spacing value in pixels
|
||||
inline int linespacing() const {
|
||||
return(_linespacing);
|
||||
}
|
||||
/// Set the line spacing value in pixels
|
||||
inline void linespacing(int val) {
|
||||
_linespacing = val;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Colors and Styles
|
||||
////////////////////////////
|
||||
/// Get the default label foreground color
|
||||
inline Fl_Color fgcolor() const {
|
||||
return(_fgcolor);
|
||||
}
|
||||
/// Set the default label foreground color
|
||||
inline void fgcolor(Fl_Color val) {
|
||||
_fgcolor = val;
|
||||
}
|
||||
/// Get the default label background color
|
||||
inline Fl_Color bgcolor() const {
|
||||
return(_bgcolor);
|
||||
}
|
||||
/// Set the default label background color
|
||||
inline void bgcolor(Fl_Color val) {
|
||||
_bgcolor = val;
|
||||
}
|
||||
/// Get the default selection color
|
||||
inline Fl_Color selectcolor() const {
|
||||
return(_selectcolor);
|
||||
}
|
||||
/// Set the default selection color
|
||||
inline void selectcolor(Fl_Color val) {
|
||||
_selectcolor = val;
|
||||
}
|
||||
/// Get the default inactive color
|
||||
inline Fl_Color inactivecolor() const {
|
||||
return(_inactivecolor);
|
||||
}
|
||||
/// Set the default inactive color
|
||||
inline void inactivecolor(Fl_Color val) {
|
||||
_inactivecolor = val;
|
||||
}
|
||||
/// Get the connector color; the color used for tree connection lines
|
||||
inline Fl_Color connectorcolor() const {
|
||||
return(_connectorcolor);
|
||||
}
|
||||
/// Set the connector color; the color used for tree connection lines
|
||||
inline void connectorcolor(Fl_Color val) {
|
||||
_connectorcolor = val;
|
||||
}
|
||||
/// Get the connector style
|
||||
inline Fl_Tree_Connector connectorstyle() const {
|
||||
return(_connectorstyle);
|
||||
}
|
||||
/// Set the connector style
|
||||
inline void connectorstyle(Fl_Tree_Connector val) {
|
||||
_connectorstyle = val;
|
||||
}
|
||||
/// Set the connector style [integer].
|
||||
inline void connectorstyle(int val) {
|
||||
_connectorstyle = Fl_Tree_Connector(val);
|
||||
}
|
||||
/// Get the tree connection line's width
|
||||
inline int connectorwidth() const {
|
||||
return(_connectorwidth);
|
||||
}
|
||||
/// Set the tree connection line's width
|
||||
inline void connectorwidth(int val) {
|
||||
_connectorwidth = val;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Icons
|
||||
////////////////////////////
|
||||
/// Get the current default 'open' icon.
|
||||
/// Returns the Fl_Pixmap* of the icon, or 0 if none.
|
||||
///
|
||||
inline Fl_Pixmap *openicon() const {
|
||||
return(_openpixmap);
|
||||
}
|
||||
void openicon(Fl_Pixmap *val);
|
||||
/// Gets the default 'close' icon
|
||||
/// Returns the Fl_Pixmap* of the icon, or 0 if none.
|
||||
///
|
||||
inline Fl_Pixmap *closeicon() const {
|
||||
return(_closepixmap);
|
||||
}
|
||||
void closeicon(Fl_Pixmap *val);
|
||||
/// Gets the default 'user icon' (default is 0)
|
||||
inline Fl_Pixmap *usericon() const {
|
||||
return(_userpixmap);
|
||||
}
|
||||
/// Sets the default 'user icon'
|
||||
/// Returns the Fl_Pixmap* of the icon, or 0 if none (default).
|
||||
///
|
||||
inline void usericon(Fl_Pixmap *val) {
|
||||
_userpixmap = val;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Options
|
||||
////////////////////////////
|
||||
/// Returns 1 if the collapse icon is enabled, 0 if not.
|
||||
inline char showcollapse() const {
|
||||
return(_showcollapse);
|
||||
}
|
||||
/// Set if we should show the collapse icon or not.
|
||||
/// If collapse icons are disabled, the user will not be able
|
||||
/// to interactively collapse items in the tree, unless the application
|
||||
/// provides some other means via open() and close().
|
||||
///
|
||||
/// \param[in] val 1: shows collapse icons (default),\n
|
||||
/// 0: hides collapse icons.
|
||||
///
|
||||
inline void showcollapse(int val) {
|
||||
_showcollapse = val;
|
||||
}
|
||||
/// Get the default sort order value
|
||||
inline Fl_Tree_Sort sortorder() const {
|
||||
return(_sortorder);
|
||||
}
|
||||
/// Set the default sort order value.
|
||||
/// Defines the order new items appear when add()ed to the tree.
|
||||
/// See Fl_Tree_Sort for possible values.
|
||||
///
|
||||
inline void sortorder(Fl_Tree_Sort val) {
|
||||
_sortorder = val;
|
||||
}
|
||||
/// Get the default selection box's box drawing style as an Fl_Boxtype.
|
||||
inline Fl_Boxtype selectbox() const {
|
||||
return(_selectbox);
|
||||
}
|
||||
/// Set the default selection box's box drawing style to \p val.
|
||||
inline void selectbox(Fl_Boxtype val) {
|
||||
_selectbox = val;
|
||||
}
|
||||
/// Returns 1 if the root item is to be shown, or 0 if not.
|
||||
inline int showroot() const {
|
||||
return(int(_showroot));
|
||||
}
|
||||
/// Set if the root item should be shown or not.
|
||||
/// \param[in] val 1 -- show the root item (default)\n
|
||||
/// 0 -- hide the root item.
|
||||
///
|
||||
inline void showroot(int val) {
|
||||
_showroot = char(val);
|
||||
}
|
||||
/// Get the selection mode used for the tree
|
||||
inline Fl_Tree_Select selectmode() const {
|
||||
return(_selectmode);
|
||||
}
|
||||
/// Set the selection mode used for the tree to \p val.
|
||||
/// This affects how items in the tree are selected
|
||||
/// when clicked on and dragged over by the mouse.
|
||||
/// See Fl_Tree_Select for possible values.
|
||||
///
|
||||
inline void selectmode(Fl_Tree_Select val) {
|
||||
_selectmode = val;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /*FL_TREE_PREFS_H*/
|
||||
BIN
documentation/src/tree-elements.png
Normal file
BIN
documentation/src/tree-elements.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
648
fluid/makedepend
648
fluid/makedepend
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,13 @@
|
||||
C904DE7910AEDD3700266003 /* table.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C918E1410DDA11BA00167E99 /* table.cxx */; };
|
||||
C904DE7B10AEDD3700266003 /* fltk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A3E9510DD6336500486E4F /* fltk.framework */; };
|
||||
C904DE7D10AEDD3700266003 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C9A3E9510DD6336500486E4F /* fltk.framework */; };
|
||||
C904DF2610AEFF3E00266003 /* Fl_Tree_Item_Array.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C904DF2210AEFF3E00266003 /* Fl_Tree_Item_Array.cxx */; };
|
||||
C904DF2710AEFF3E00266003 /* Fl_Tree_Item.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C904DF2310AEFF3E00266003 /* Fl_Tree_Item.cxx */; };
|
||||
C904DF2810AEFF3E00266003 /* Fl_Tree_Prefs.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C904DF2410AEFF3E00266003 /* Fl_Tree_Prefs.cxx */; };
|
||||
C904DF2910AEFF3E00266003 /* Fl_Tree.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C904DF2510AEFF3E00266003 /* Fl_Tree.cxx */; };
|
||||
C904DF3210AEFF4A00266003 /* fltk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A3E9510DD6336500486E4F /* fltk.framework */; };
|
||||
C904DF3410AEFF4A00266003 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C9A3E9510DD6336500486E4F /* fltk.framework */; };
|
||||
C904DF5A10AF003400266003 /* tree.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C904DF5910AF003400266003 /* tree.cxx */; };
|
||||
C918DB410DD9EE7500167E99 /* editor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C918DB400DD9EE7500167E99 /* editor.cxx */; };
|
||||
C918DB4D0DD9EE8F00167E99 /* fltk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A3E9510DD6336500486E4F /* fltk.framework */; };
|
||||
C918DB5F0DD9EED100167E99 /* fast_slow.fl in Resources */ = {isa = PBXBuildFile; fileRef = C918DB5E0DD9EED100167E99 /* fast_slow.fl */; };
|
||||
@@ -579,6 +586,18 @@
|
||||
);
|
||||
script = "export DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ../../test && ${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}";
|
||||
};
|
||||
C904DF3510AEFF4A00266003 /* PBXBuildRule */ = {
|
||||
isa = PBXBuildRule;
|
||||
compilerSpec = com.apple.compilers.proxy.script;
|
||||
filePatterns = "*.fl";
|
||||
fileType = pattern.proxy;
|
||||
isEditable = 1;
|
||||
outputFiles = (
|
||||
"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.cxx",
|
||||
"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.h",
|
||||
);
|
||||
script = "export DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ../../test && ${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}";
|
||||
};
|
||||
C918DB780DD9EF6800167E99 /* PBXBuildRule */ = {
|
||||
isa = PBXBuildRule;
|
||||
compilerSpec = com.apple.compilers.proxy.script;
|
||||
@@ -730,6 +749,20 @@
|
||||
remoteGlobalIDString = C904DE7110AEDD3700266003 /* table */;
|
||||
remoteInfo = table;
|
||||
};
|
||||
C904DF2D10AEFF4A00266003 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C9A3E93C0DD6332D00486E4F /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = C9A3E9500DD6336500486E4F;
|
||||
remoteInfo = fltk;
|
||||
};
|
||||
C904DF4A10AEFFB900266003 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C9A3E93C0DD6332D00486E4F /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = C904DF2B10AEFF4A00266003 /* tree */;
|
||||
remoteInfo = tree;
|
||||
};
|
||||
C918DB3D0DD9EE4600167E99 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C9A3E93C0DD6332D00486E4F /* Project object */;
|
||||
@@ -1968,6 +2001,16 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C904DF3310AEFF4A00266003 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
C904DF3410AEFF4A00266003 /* fltk.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C94A76BC0E76D4A800AAA38E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -2666,6 +2709,13 @@
|
||||
C904DE6D10AEDD2A00266003 /* Fl_Table.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Table.cxx; path = ../../src/Fl_Table.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C904DE8210AEDD3700266003 /* table.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = table.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C904DE8F10AEDD3800266003 /* tabs-Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "tabs-Info copy.plist"; path = "plists/tabs-Info copy.plist"; sourceTree = "<group>"; };
|
||||
C904DF2210AEFF3E00266003 /* Fl_Tree_Item_Array.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Item_Array.cxx; path = ../../src/Fl_Tree_Item_Array.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C904DF2310AEFF3E00266003 /* Fl_Tree_Item.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Item.cxx; path = ../../src/Fl_Tree_Item.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C904DF2410AEFF3E00266003 /* Fl_Tree_Prefs.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Prefs.cxx; path = ../../src/Fl_Tree_Prefs.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C904DF2510AEFF3E00266003 /* Fl_Tree.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree.cxx; path = ../../src/Fl_Tree.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C904DF3910AEFF4A00266003 /* tree.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = tree.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C904DF4010AEFF4A00266003 /* table-Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "table-Info copy.plist"; path = "plists/table-Info copy.plist"; sourceTree = "<group>"; };
|
||||
C904DF5910AF003400266003 /* tree.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tree.cxx; path = ../../test/tree.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C918DB370DD9EE4100167E99 /* editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = editor.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C918DB390DD9EE4100167E99 /* editor-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "editor-Info.plist"; path = "plists/editor-Info.plist"; sourceTree = "<group>"; };
|
||||
C918DB400DD9EE7500167E99 /* editor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = editor.cxx; path = ../../test/editor.cxx; sourceTree = SOURCE_ROOT; };
|
||||
@@ -3174,6 +3224,14 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C904DF3110AEFF4A00266003 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C904DF3210AEFF4A00266003 /* fltk.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C918DB350DD9EE4100167E99 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -3819,6 +3877,7 @@
|
||||
C9DD58060DD7834400A896B4 /* libs */,
|
||||
C9A3E9520DD6336500486E4F /* Products */,
|
||||
C9A3EE790DD64B0200486E4F /* TODO */,
|
||||
C904DF4010AEFF4A00266003 /* table-Info copy.plist */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -3897,6 +3956,7 @@
|
||||
C99E1EAE0E78628600AECCF6 /* curve.app */,
|
||||
C9EAC2DC0E786725004F64F7 /* colbrowser.app */,
|
||||
C904DE8210AEDD3700266003 /* table.app */,
|
||||
C904DF3910AEFF4A00266003 /* tree.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -3983,6 +4043,10 @@
|
||||
C9A3E9590DD6338B00486E4F /* Library Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C904DF2210AEFF3E00266003 /* Fl_Tree_Item_Array.cxx */,
|
||||
C904DF2310AEFF3E00266003 /* Fl_Tree_Item.cxx */,
|
||||
C904DF2410AEFF3E00266003 /* Fl_Tree_Prefs.cxx */,
|
||||
C904DF2510AEFF3E00266003 /* Fl_Tree.cxx */,
|
||||
C904DE6C10AEDD2A00266003 /* Fl_Table_Row.cxx */,
|
||||
C904DE6D10AEDD2A00266003 /* Fl_Table.cxx */,
|
||||
C9A3EAD80DD634CC00486E4F /* Fl_get_key_mac.cxx */,
|
||||
@@ -4257,6 +4321,7 @@
|
||||
C918E15B0DDA11FE00167E99 /* threads.cxx */,
|
||||
C918E17B0DDA124500167E99 /* tile.cxx */,
|
||||
C918E1A10DDA128900167E99 /* tiled_image.cxx */,
|
||||
C904DF5910AF003400266003 /* tree.cxx */,
|
||||
C918E1CB0DDA132100167E99 /* valuators.fl */,
|
||||
C918E1DA0DDA133400167E99 /* valuators.cxx */,
|
||||
);
|
||||
@@ -4451,6 +4516,26 @@
|
||||
productReference = C904DE8210AEDD3700266003 /* table.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
C904DF2B10AEFF4A00266003 /* tree */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C904DF3610AEFF4A00266003 /* Build configuration list for PBXNativeTarget "tree" */;
|
||||
buildPhases = (
|
||||
C904DF2E10AEFF4A00266003 /* Resources */,
|
||||
C904DF2F10AEFF4A00266003 /* Sources */,
|
||||
C904DF3110AEFF4A00266003 /* Frameworks */,
|
||||
C904DF3310AEFF4A00266003 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
C904DF3510AEFF4A00266003 /* PBXBuildRule */,
|
||||
);
|
||||
dependencies = (
|
||||
C904DF2C10AEFF4A00266003 /* PBXTargetDependency */,
|
||||
);
|
||||
name = tree;
|
||||
productName = tabs;
|
||||
productReference = C904DF3910AEFF4A00266003 /* tree.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
C918DB360DD9EE4100167E99 /* editor */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C918DB3C0DD9EE4100167E99 /* Build configuration list for PBXNativeTarget "editor" */;
|
||||
@@ -5426,6 +5511,7 @@
|
||||
C918E2380DDA13BC00167E99 /* PBXTargetDependency */,
|
||||
C918E23A0DDA13BC00167E99 /* PBXTargetDependency */,
|
||||
C918E23C0DDA13BC00167E99 /* PBXTargetDependency */,
|
||||
C904DF4B10AEFFB900266003 /* PBXTargetDependency */,
|
||||
C9EAC41F0E78730F004F64F7 /* PBXTargetDependency */,
|
||||
C918E23E0DDA13BC00167E99 /* PBXTargetDependency */,
|
||||
C9FF1F9B0E7C48EE001149A6 /* PBXTargetDependency */,
|
||||
@@ -6002,6 +6088,7 @@
|
||||
C918E1510DDA11E400167E99 /* threads */,
|
||||
C918E1710DDA122D00167E99 /* tile */,
|
||||
C918E1910DDA126E00167E99 /* tiled_image */,
|
||||
C904DF2B10AEFF4A00266003 /* tree */,
|
||||
C94A76CF0E77F59E00AAA38E /* utf8 */,
|
||||
C918E1BD0DDA12CF00167E99 /* valuators */,
|
||||
);
|
||||
@@ -6016,6 +6103,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C904DF2E10AEFF4A00266003 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C918DB330DD9EE4100167E99 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -6535,6 +6629,14 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C904DF2F10AEFF4A00266003 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C904DF5A10AF003400266003 /* tree.cxx in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C918DB340DD9EE4100167E99 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -7077,6 +7179,10 @@
|
||||
C99E1E9D0E78620B00AECCF6 /* is_spacing.c in Sources */,
|
||||
C904DE6E10AEDD2A00266003 /* Fl_Table_Row.cxx in Sources */,
|
||||
C904DE6F10AEDD2A00266003 /* Fl_Table.cxx in Sources */,
|
||||
C904DF2610AEFF3E00266003 /* Fl_Tree_Item_Array.cxx in Sources */,
|
||||
C904DF2710AEFF3E00266003 /* Fl_Tree_Item.cxx in Sources */,
|
||||
C904DF2810AEFF3E00266003 /* Fl_Tree_Prefs.cxx in Sources */,
|
||||
C904DF2910AEFF3E00266003 /* Fl_Tree.cxx in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -7369,6 +7475,16 @@
|
||||
target = C904DE7110AEDD3700266003 /* table */;
|
||||
targetProxy = C904DEB810AEE0BD00266003 /* PBXContainerItemProxy */;
|
||||
};
|
||||
C904DF2C10AEFF4A00266003 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = C9A3E9500DD6336500486E4F /* fltk */;
|
||||
targetProxy = C904DF2D10AEFF4A00266003 /* PBXContainerItemProxy */;
|
||||
};
|
||||
C904DF4B10AEFFB900266003 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = C904DF2B10AEFF4A00266003 /* tree */;
|
||||
targetProxy = C904DF4A10AEFFB900266003 /* PBXContainerItemProxy */;
|
||||
};
|
||||
C918DB3E0DD9EE4600167E99 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = C9A3E9500DD6336500486E4F /* fltk */;
|
||||
@@ -8294,6 +8410,53 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C904DF3710AEFF4A00266003 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
|
||||
HEADER_SEARCH_PATHS = ../../;
|
||||
INFOPLIST_FILE = "plists/tree-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Carbon,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = tree;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C904DF3810AEFF4A00266003 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
|
||||
HEADER_SEARCH_PATHS = ../../;
|
||||
INFOPLIST_FILE = "plists/tree-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Carbon,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = tree;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C918DB3A0DD9EE4100167E99 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -11747,6 +11910,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C904DF3610AEFF4A00266003 /* Build configuration list for PBXNativeTarget "tree" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C904DF3710AEFF4A00266003 /* Debug */,
|
||||
C904DF3810AEFF4A00266003 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C918DB3C0DD9EE4100167E99 /* Build configuration list for PBXNativeTarget "editor" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
20
ide/Xcode3.1/plists/tree-Info.plist
Normal file
20
ide/Xcode3.1/plists/tree-Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.fltk.table</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>FLTK</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
154
jpeg/makedepend
154
jpeg/makedepend
@@ -1,94 +1,64 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
jmemnobs.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jmemnobs.o: jerror.h jmemsys.h
|
||||
jcapimin.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcapimin.o: jerror.h
|
||||
jcapistd.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcapistd.o: jerror.h
|
||||
jccoefct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jccoefct.o: jerror.h
|
||||
jccolor.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jccolor.o: jerror.h
|
||||
jcdctmgr.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcdctmgr.o: jerror.h jdct.h
|
||||
jchuff.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jchuff.o: jerror.h jchuff.h
|
||||
jcinit.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcinit.o: jerror.h
|
||||
jcmainct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcmainct.o: jerror.h
|
||||
jcmarker.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcmarker.o: jerror.h
|
||||
jcmaster.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcmaster.o: jerror.h
|
||||
jcomapi.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcomapi.o: jerror.h
|
||||
jcparam.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcparam.o: jerror.h
|
||||
jcphuff.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcphuff.o: jerror.h jchuff.h
|
||||
jcprepct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcprepct.o: jerror.h
|
||||
jcsample.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jcsample.o: jerror.h
|
||||
jctrans.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jctrans.o: jerror.h
|
||||
jdapimin.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdapimin.o: jerror.h
|
||||
jdapistd.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdapistd.o: jerror.h
|
||||
jdatadst.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdatadst.o: jerror.h
|
||||
jdatasrc.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdatasrc.o: jerror.h
|
||||
jdcoefct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdcoefct.o: jerror.h
|
||||
jdcolor.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdcolor.o: jerror.h
|
||||
jddctmgr.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jddctmgr.o: jerror.h jdct.h
|
||||
jdhuff.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdhuff.o: jerror.h jdhuff.h
|
||||
jdinput.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdinput.o: jerror.h
|
||||
jdmainct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdmainct.o: jerror.h
|
||||
jdmarker.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdmarker.o: jerror.h
|
||||
jdmaster.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdmaster.o: jerror.h
|
||||
jdmerge.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdmerge.o: jerror.h
|
||||
jdphuff.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdphuff.o: jerror.h jdhuff.h
|
||||
jdpostct.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdpostct.o: jerror.h
|
||||
jdsample.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdsample.o: jerror.h
|
||||
jdtrans.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jdtrans.o: jerror.h
|
||||
jerror.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jerror.o: jerror.h jversion.h
|
||||
jfdctflt.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jfdctflt.o: jerror.h jdct.h
|
||||
jfdctfst.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jfdctfst.o: jerror.h jdct.h
|
||||
jfdctint.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jfdctint.o: jerror.h jdct.h
|
||||
jidctflt.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jidctflt.o: jerror.h jdct.h
|
||||
jidctfst.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jidctfst.o: jerror.h jdct.h
|
||||
jidctint.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jidctint.o: jerror.h jdct.h
|
||||
jidctred.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jidctred.o: jerror.h jdct.h
|
||||
jquant1.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jquant1.o: jerror.h
|
||||
jquant2.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jquant2.o: jerror.h
|
||||
jutils.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jutils.o: jerror.h
|
||||
jmemmgr.o: jinclude.h jconfig.h ../config.h jpeglib.h jmorecfg.h jpegint.h
|
||||
jmemmgr.o: jerror.h jmemsys.h
|
||||
jmemnobs.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jmemnobs.o: jmemsys.h
|
||||
jcapimin.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcapistd.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jccoefct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jccolor.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcdctmgr.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcdctmgr.o: jdct.h
|
||||
jchuff.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jchuff.o: jchuff.h
|
||||
jcinit.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcmainct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcmarker.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcmaster.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcomapi.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcparam.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcphuff.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcphuff.o: jchuff.h
|
||||
jcprepct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jcsample.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jctrans.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdapimin.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdapistd.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdatadst.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdatasrc.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdcoefct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdcolor.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jddctmgr.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jddctmgr.o: jdct.h
|
||||
jdhuff.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdhuff.o: jdhuff.h
|
||||
jdinput.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdmainct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdmarker.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdmaster.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdmerge.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdphuff.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdphuff.o: jdhuff.h
|
||||
jdpostct.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdsample.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jdtrans.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jerror.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jerror.o: jversion.h
|
||||
jfdctflt.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jfdctflt.o: jdct.h
|
||||
jfdctfst.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jfdctfst.o: jdct.h
|
||||
jfdctint.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jfdctint.o: jdct.h
|
||||
jidctflt.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jidctflt.o: jdct.h
|
||||
jidctfst.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jidctfst.o: jdct.h
|
||||
jidctint.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jidctint.o: jdct.h
|
||||
jidctred.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jidctred.o: jdct.h
|
||||
jquant1.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jquant2.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jutils.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jmemmgr.o: jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
|
||||
jmemmgr.o: jmemsys.h
|
||||
|
||||
748
src/Fl_Table.cxx
748
src/Fl_Table.cxx
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ void Fl_Table_Row::type(TableRowSelectMode val) {
|
||||
case SELECT_NONE:
|
||||
{
|
||||
for ( int row=0; row<rows(); row++ ) {
|
||||
_rowselect[row] = 0;
|
||||
_rowselect[row] = 0;
|
||||
}
|
||||
redraw();
|
||||
break;
|
||||
@@ -55,11 +55,11 @@ void Fl_Table_Row::type(TableRowSelectMode val) {
|
||||
{
|
||||
int count = 0;
|
||||
for ( int row=0; row<rows(); row++ ) {
|
||||
if ( _rowselect[row] ) {
|
||||
if ( ++count > 1 ) { // only one allowed
|
||||
_rowselect[row] = 0;
|
||||
}
|
||||
}
|
||||
if ( _rowselect[row] ) {
|
||||
if ( ++count > 1 ) { // only one allowed
|
||||
_rowselect[row] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw();
|
||||
break;
|
||||
@@ -87,39 +87,39 @@ int Fl_Table_Row::select_row(int row, int flag) {
|
||||
switch ( _selectmode ) {
|
||||
case SELECT_NONE:
|
||||
return(-1);
|
||||
|
||||
|
||||
case SELECT_SINGLE:
|
||||
{
|
||||
int oldval;
|
||||
for ( int t=0; t<rows(); t++ ) {
|
||||
if ( t == row ) {
|
||||
oldval = _rowselect[row];
|
||||
if ( flag == 2 ) { _rowselect[row] ^= 1; }
|
||||
else { _rowselect[row] = flag; }
|
||||
if ( oldval != _rowselect[row] ) {
|
||||
redraw_range(row, row, leftcol, rightcol);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
else if ( _rowselect[t] ) {
|
||||
_rowselect[t] = 0;
|
||||
redraw_range(t, t, leftcol, rightcol);
|
||||
}
|
||||
if ( t == row ) {
|
||||
oldval = _rowselect[row];
|
||||
if ( flag == 2 ) { _rowselect[row] ^= 1; }
|
||||
else { _rowselect[row] = flag; }
|
||||
if ( oldval != _rowselect[row] ) {
|
||||
redraw_range(row, row, leftcol, rightcol);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
else if ( _rowselect[t] ) {
|
||||
_rowselect[t] = 0;
|
||||
redraw_range(t, t, leftcol, rightcol);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case SELECT_MULTI:
|
||||
{
|
||||
int oldval = _rowselect[row];
|
||||
if ( flag == 2 ) { _rowselect[row] ^= 1; }
|
||||
else { _rowselect[row] = flag; }
|
||||
if ( _rowselect[row] != oldval ) { // select state changed?
|
||||
if ( row >= toprow && row <= botrow ) { // row visible?
|
||||
// Extend partial redraw range
|
||||
redraw_range(row, row, leftcol, rightcol);
|
||||
}
|
||||
ret = 1;
|
||||
if ( row >= toprow && row <= botrow ) { // row visible?
|
||||
// Extend partial redraw range
|
||||
redraw_range(row, row, leftcol, rightcol);
|
||||
}
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,24 +131,24 @@ void Fl_Table_Row::select_all_rows(int flag) {
|
||||
switch ( _selectmode ) {
|
||||
case SELECT_NONE:
|
||||
return;
|
||||
|
||||
|
||||
case SELECT_SINGLE:
|
||||
if ( flag != 0 ) return;
|
||||
//FALLTHROUGH
|
||||
|
||||
|
||||
case SELECT_MULTI:
|
||||
{
|
||||
char changed = 0;
|
||||
if ( flag == 2 ) {
|
||||
for ( int row=0; row<(int)_rowselect.size(); row++ ) {
|
||||
_rowselect[row] ^= 1;
|
||||
}
|
||||
changed = 1;
|
||||
for ( int row=0; row<(int)_rowselect.size(); row++ ) {
|
||||
_rowselect[row] ^= 1;
|
||||
}
|
||||
changed = 1;
|
||||
} else {
|
||||
for ( int row=0; row<(int)_rowselect.size(); row++ ) {
|
||||
changed |= (_rowselect[row] != flag)?1:0;
|
||||
_rowselect[row] = flag;
|
||||
}
|
||||
for ( int row=0; row<(int)_rowselect.size(); row++ ) {
|
||||
changed |= (_rowselect[row] != flag)?1:0;
|
||||
_rowselect[row] = flag;
|
||||
}
|
||||
}
|
||||
if ( changed ) {
|
||||
redraw();
|
||||
@@ -169,19 +169,19 @@ void Fl_Table_Row::rows(int val) {
|
||||
|
||||
// Handle events
|
||||
int Fl_Table_Row::handle(int event) {
|
||||
|
||||
|
||||
// fprintf(stderr, "** EVENT: %s: EVENT XY=%d,%d\n",
|
||||
// eventnames[event], Fl::event_x(), Fl::event_y()); // debugging
|
||||
|
||||
|
||||
// Let base class handle event
|
||||
int ret = Fl_Table::handle(event);
|
||||
|
||||
|
||||
// The following code disables cell selection.. why was it added? -erco 05/18/03
|
||||
// if ( ret ) { _last_y = Fl::event_y(); return(1); } // base class 'handled' it (eg. column resize)
|
||||
|
||||
|
||||
int shiftstate = (Fl::event_state() & FL_CTRL) ? FL_CTRL :
|
||||
(Fl::event_state() & FL_SHIFT) ? FL_SHIFT : 0;
|
||||
|
||||
(Fl::event_state() & FL_SHIFT) ? FL_SHIFT : 0;
|
||||
|
||||
// Which row/column are we over?
|
||||
int R, C; // row/column being worked on
|
||||
ResizeFlag resizeflag; // which resizing area are we over? (0=none)
|
||||
@@ -189,128 +189,128 @@ int Fl_Table_Row::handle(int event) {
|
||||
switch ( event ) {
|
||||
case FL_PUSH:
|
||||
if ( Fl::event_button() == 1 ) {
|
||||
_last_push_x = Fl::event_x(); // save regardless of context
|
||||
_last_push_y = Fl::event_y(); // " "
|
||||
|
||||
// Handle selection in table.
|
||||
// Select cell under cursor, and enable drag selection mode.
|
||||
//
|
||||
if ( context == CONTEXT_CELL ) {
|
||||
// Ctrl key? Toggle selection state
|
||||
switch ( shiftstate ) {
|
||||
case FL_CTRL:
|
||||
select_row(R, 2); // toggle
|
||||
break;
|
||||
|
||||
case FL_SHIFT:
|
||||
{
|
||||
select_row(R, 1);
|
||||
if ( _last_row > -1 ) {
|
||||
int srow = R, erow = _last_row;
|
||||
if ( srow > erow ) {
|
||||
srow = _last_row;
|
||||
erow = R;
|
||||
}
|
||||
for ( int row = srow; row <= erow; row++ ) {
|
||||
select_row(row, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
select_all_rows(0); // clear all previous selections
|
||||
select_row(R, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
_last_row = R;
|
||||
_dragging_select = 1;
|
||||
ret = 1; // FL_PUSH handled (ensures FL_DRAG will be sent)
|
||||
// redraw(); // redraw() handled by select_row()
|
||||
}
|
||||
_last_push_x = Fl::event_x(); // save regardless of context
|
||||
_last_push_y = Fl::event_y(); // " "
|
||||
|
||||
// Handle selection in table.
|
||||
// Select cell under cursor, and enable drag selection mode.
|
||||
//
|
||||
if ( context == CONTEXT_CELL ) {
|
||||
// Ctrl key? Toggle selection state
|
||||
switch ( shiftstate ) {
|
||||
case FL_CTRL:
|
||||
select_row(R, 2); // toggle
|
||||
break;
|
||||
|
||||
case FL_SHIFT:
|
||||
{
|
||||
select_row(R, 1);
|
||||
if ( _last_row > -1 ) {
|
||||
int srow = R, erow = _last_row;
|
||||
if ( srow > erow ) {
|
||||
srow = _last_row;
|
||||
erow = R;
|
||||
}
|
||||
for ( int row = srow; row <= erow; row++ ) {
|
||||
select_row(row, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
select_all_rows(0); // clear all previous selections
|
||||
select_row(R, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
_last_row = R;
|
||||
_dragging_select = 1;
|
||||
ret = 1; // FL_PUSH handled (ensures FL_DRAG will be sent)
|
||||
// redraw(); // redraw() handled by select_row()
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FL_DRAG:
|
||||
{
|
||||
if ( _dragging_select ) {
|
||||
// Dragged off table edges? Handle scrolling
|
||||
int offtop = toy - _last_y; // >0 if off top of table
|
||||
int offbot = _last_y - (toy + toh); // >0 if off bottom of table
|
||||
|
||||
if ( offtop > 0 && row_position() > 0 ) {
|
||||
// Only scroll in upward direction
|
||||
int diff = _last_y - Fl::event_y();
|
||||
if ( diff < 1 ) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
row_position(row_position() - diff);
|
||||
context = CONTEXT_CELL; C = 0; R = row_position(); // HACK: fake it
|
||||
if ( R < 0 || R > rows() ) { ret = 1; break; } // HACK: ugly
|
||||
}
|
||||
else if ( offbot > 0 && botrow < rows() ) {
|
||||
// Only scroll in downward direction
|
||||
int diff = Fl::event_y() - _last_y;
|
||||
if ( diff < 1 ) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
row_position(row_position() + diff);
|
||||
context = CONTEXT_CELL; C = 0; R = botrow; // HACK: fake it
|
||||
if ( R < 0 || R > rows() ) { ret = 1; break; } // HACK: ugly
|
||||
}
|
||||
if ( context == CONTEXT_CELL ) {
|
||||
switch ( shiftstate ) {
|
||||
case FL_CTRL:
|
||||
if ( R != _last_row ) { // toggle if dragged to new row
|
||||
select_row(R, 2); // 2=toggle
|
||||
}
|
||||
break;
|
||||
|
||||
case FL_SHIFT:
|
||||
default:
|
||||
select_row(R, 1);
|
||||
if ( _last_row > -1 ) {
|
||||
int srow = R, erow = _last_row;
|
||||
if ( srow > erow ) {
|
||||
srow = _last_row;
|
||||
erow = R;
|
||||
}
|
||||
for ( int row = srow; row <= erow; row++ ) {
|
||||
select_row(row, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ret = 1; // drag handled
|
||||
_last_row = R;
|
||||
}
|
||||
// Dragged off table edges? Handle scrolling
|
||||
int offtop = toy - _last_y; // >0 if off top of table
|
||||
int offbot = _last_y - (toy + toh); // >0 if off bottom of table
|
||||
|
||||
if ( offtop > 0 && row_position() > 0 ) {
|
||||
// Only scroll in upward direction
|
||||
int diff = _last_y - Fl::event_y();
|
||||
if ( diff < 1 ) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
row_position(row_position() - diff);
|
||||
context = CONTEXT_CELL; C = 0; R = row_position(); // HACK: fake it
|
||||
if ( R < 0 || R > rows() ) { ret = 1; break; } // HACK: ugly
|
||||
}
|
||||
else if ( offbot > 0 && botrow < rows() ) {
|
||||
// Only scroll in downward direction
|
||||
int diff = Fl::event_y() - _last_y;
|
||||
if ( diff < 1 ) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
row_position(row_position() + diff);
|
||||
context = CONTEXT_CELL; C = 0; R = botrow; // HACK: fake it
|
||||
if ( R < 0 || R > rows() ) { ret = 1; break; } // HACK: ugly
|
||||
}
|
||||
if ( context == CONTEXT_CELL ) {
|
||||
switch ( shiftstate ) {
|
||||
case FL_CTRL:
|
||||
if ( R != _last_row ) { // toggle if dragged to new row
|
||||
select_row(R, 2); // 2=toggle
|
||||
}
|
||||
break;
|
||||
|
||||
case FL_SHIFT:
|
||||
default:
|
||||
select_row(R, 1);
|
||||
if ( _last_row > -1 ) {
|
||||
int srow = R, erow = _last_row;
|
||||
if ( srow > erow ) {
|
||||
srow = _last_row;
|
||||
erow = R;
|
||||
}
|
||||
for ( int row = srow; row <= erow; row++ ) {
|
||||
select_row(row, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ret = 1; // drag handled
|
||||
_last_row = R;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case FL_RELEASE:
|
||||
if ( Fl::event_button() == 1 ) {
|
||||
_dragging_select = 0;
|
||||
ret = 1; // release handled
|
||||
// Clicked off edges of data table?
|
||||
// A way for user to clear the current selection.
|
||||
//
|
||||
int databot = tiy + table_h,
|
||||
dataright = tix + table_w;
|
||||
if (
|
||||
( _last_push_x > dataright && Fl::event_x() > dataright ) ||
|
||||
( _last_push_y > databot && Fl::event_y() > databot )
|
||||
) {
|
||||
select_all_rows(0); // clear previous selections
|
||||
}
|
||||
_dragging_select = 0;
|
||||
ret = 1; // release handled
|
||||
// Clicked off edges of data table?
|
||||
// A way for user to clear the current selection.
|
||||
//
|
||||
int databot = tiy + table_h,
|
||||
dataright = tix + table_w;
|
||||
if (
|
||||
( _last_push_x > dataright && Fl::event_x() > dataright ) ||
|
||||
( _last_push_y > databot && Fl::event_y() > databot )
|
||||
) {
|
||||
select_all_rows(0); // clear previous selections
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
_last_y = Fl::event_y();
|
||||
return(ret);
|
||||
|
||||
354
src/Fl_Tree.cxx
Normal file
354
src/Fl_Tree.cxx
Normal file
@@ -0,0 +1,354 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <FL/Fl_Tree.H>
|
||||
|
||||
#define SCROLL_W 15
|
||||
|
||||
//////////////////////
|
||||
// Fl_Tree.cxx
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// INTERNAL: scroller callback
|
||||
static void scroll_cb(Fl_Widget*,void *data) {
|
||||
((Fl_Tree*)data)->redraw();
|
||||
}
|
||||
|
||||
// INTERNAL: Parse elements from path into an array of null terminated strings
|
||||
// Path="/aa/bb"
|
||||
// Return: arr[0]="aa", arr[1]="bb", arr[2]=0
|
||||
// Caller must: free(arr[0]); free(arr);
|
||||
//
|
||||
static char **parse_path(const char *path) {
|
||||
while ( *path == '/' ) path++; // skip leading '/'
|
||||
// First pass: identify, null terminate, and count separators
|
||||
int seps = 1; // separator count (1: first item)
|
||||
int arrsize = 1; // array size (1: first item)
|
||||
char *save = strdup(path); // make copy we can modify
|
||||
char *s = save;
|
||||
while ( ( s = strchr(s, '/') ) ) {
|
||||
while ( *s == '/' ) { *s++ = 0; seps++; }
|
||||
if ( *s ) { arrsize++; }
|
||||
}
|
||||
arrsize++; // (room for terminating NULL)
|
||||
// Second pass: create array, save nonblank elements
|
||||
char **arr = (char**)malloc(sizeof(char*) * arrsize);
|
||||
int t = 0;
|
||||
s = save;
|
||||
while ( seps-- > 0 ) {
|
||||
if ( *s ) { arr[t++] = s; } // skips empty fields, eg. '//'
|
||||
s += (strlen(s) + 1);
|
||||
}
|
||||
arr[t] = 0;
|
||||
return(arr);
|
||||
}
|
||||
|
||||
// INTERNAL: Recursively descend tree hierarchy, accumulating total child count
|
||||
static int find_total_children(Fl_Tree_Item *item, int count=0) {
|
||||
count++;
|
||||
for ( int t=0; t<item->children(); t++ ) {
|
||||
count = find_total_children(item->child(t), count);
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
|
||||
/// Constructor.
|
||||
Fl_Tree::Fl_Tree(int X, int Y, int W, int H, const char *L) : Fl_Group(X,Y,W,H,L) {
|
||||
_root = new Fl_Tree_Item(_prefs);
|
||||
_root->parent(0); // we are root of tree
|
||||
_root->label("ROOT");
|
||||
_item_clicked = 0;
|
||||
box(FL_DOWN_BOX);
|
||||
color(FL_WHITE);
|
||||
when(FL_WHEN_CHANGED);
|
||||
_vscroll = new Fl_Scrollbar(0,0,0,0); // will be resized by draw()
|
||||
_vscroll->hide();
|
||||
_vscroll->type(FL_VERTICAL);
|
||||
_vscroll->step(1);
|
||||
_vscroll->callback(scroll_cb, (void*)this);
|
||||
end();
|
||||
}
|
||||
|
||||
/// Destructor.
|
||||
Fl_Tree::~Fl_Tree() {
|
||||
if ( _root ) { delete _root; _root = 0; }
|
||||
}
|
||||
|
||||
/// Adds a new item, given a 'menu style' path, eg: "/Parent/Child/item".
|
||||
/// Any parent nodes that don't already exist are created automatically.
|
||||
/// Adds the item based on the value of sortorder().
|
||||
/// \returns the child item created, or 0 on error.
|
||||
///
|
||||
Fl_Tree_Item* Fl_Tree::add(const char *path) {
|
||||
if ( ! _root ) { // Create root if none
|
||||
_root = new Fl_Tree_Item(_prefs);
|
||||
_root->parent(0);
|
||||
_root->label("ROOT");
|
||||
}
|
||||
char **arr = parse_path(path);
|
||||
Fl_Tree_Item *item = _root->add(_prefs, arr);
|
||||
free((void*)arr[0]);
|
||||
free((void*)arr);
|
||||
return(item);
|
||||
}
|
||||
|
||||
/// Inserts a new item above the specified Fl_Tree_Item, with the label set to 'name'.
|
||||
/// \returns the item that was added, or 0 if 'above' could not be found.
|
||||
///
|
||||
Fl_Tree_Item* Fl_Tree::insert_above(Fl_Tree_Item *above, const char *name) {
|
||||
return(above->insert_above(_prefs, name));
|
||||
}
|
||||
|
||||
/// Find the item, given a menu style path, eg: "/Parent/Child/item".
|
||||
///
|
||||
/// There is both a const and non-const version of this method.
|
||||
/// Const version allows pure const methods to use this method
|
||||
/// to do lookups without causing compiler errors.
|
||||
/// \returns the item, or 0 if not found.
|
||||
///
|
||||
Fl_Tree_Item *Fl_Tree::find_item(const char *path) {
|
||||
if ( ! _root ) return(0);
|
||||
char **arr = parse_path(path);
|
||||
Fl_Tree_Item *item = _root->find_item(arr);
|
||||
free((void*)arr[0]);
|
||||
free((void*)arr);
|
||||
return(item);
|
||||
}
|
||||
|
||||
/// A const version of Fl_Tree::find_item(const char *path)
|
||||
const Fl_Tree_Item *Fl_Tree::find_item(const char *path) const {
|
||||
if ( ! _root ) return(0);
|
||||
char **arr = parse_path(path);
|
||||
const Fl_Tree_Item *item = _root->find_item(arr);
|
||||
free((void*)arr[0]);
|
||||
free((void*)arr);
|
||||
return(item);
|
||||
}
|
||||
|
||||
/// Standard FLTK draw() method, handles draws the tree widget.
|
||||
void Fl_Tree::draw() {
|
||||
// Let group draw box+label but *NOT* children.
|
||||
// We handle drawing children ourselves by calling each item's draw()
|
||||
//
|
||||
Fl_Group::draw_box();
|
||||
Fl_Group::draw_label();
|
||||
if ( ! _root ) return;
|
||||
int cx = x() + Fl::box_dx(box());
|
||||
int cy = y() + Fl::box_dy(box());
|
||||
int cw = w() - Fl::box_dw(box());
|
||||
int ch = h() - Fl::box_dh(box());
|
||||
// These values are changed during drawing
|
||||
// 'Y' will be the lowest point on the tree
|
||||
int X = cx + _prefs.marginleft();
|
||||
int Y = cy + _prefs.margintop() - (_vscroll->visible() ? _vscroll->value() : 0);
|
||||
int W = cw - _prefs.marginleft(); // - _prefs.marginright();
|
||||
int Ysave = Y;
|
||||
fl_push_clip(cx,cy,cw,ch);
|
||||
{
|
||||
fl_font(_prefs.labelfont(), _prefs.labelsize());
|
||||
_root->draw(X, Y, W, this, _prefs);
|
||||
}
|
||||
fl_pop_clip();
|
||||
|
||||
// Show vertical scrollbar?
|
||||
int ydiff = (Y+_prefs.margintop())-Ysave; // ydiff=size of tree
|
||||
int ytoofar = (cy+ch) - Y; // ytoofar -- scrolled beyond bottom (eg. stow)
|
||||
|
||||
//printf("ydiff=%d ch=%d Ysave=%d ytoofar=%d value=%d\n",
|
||||
//int(ydiff),int(ch),int(Ysave),int(ytoofar), int(_vscroll->value()));
|
||||
|
||||
if ( ytoofar > 0 ) ydiff += ytoofar;
|
||||
if ( Ysave<cy || ydiff > ch || int(_vscroll->value()) > 1 ) {
|
||||
_vscroll->visible();
|
||||
int sx = x()+w()-Fl::box_dx(box())-SCROLL_W;
|
||||
int sy = y()+Fl::box_dy(box());
|
||||
int sw = SCROLL_W;
|
||||
int sh = h()-Fl::box_dh(box());
|
||||
_vscroll->show();
|
||||
_vscroll->range(0.0,ydiff-ch);
|
||||
_vscroll->resize(sx,sy,sw,sh);
|
||||
_vscroll->slider_size(float(ch)/float(ydiff));
|
||||
} else {
|
||||
_vscroll->Fl_Slider::value(0);
|
||||
_vscroll->hide();
|
||||
}
|
||||
fl_push_clip(cx,cy,cw,ch);
|
||||
Fl_Group::draw_children(); // draws any FLTK children set via Fl_Tree::widget()
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
||||
/// Standard FLTK event handler for this widget.
|
||||
int Fl_Tree::handle(int e) {
|
||||
static Fl_Tree_Item *lastselect = 0;
|
||||
int changed = 0;
|
||||
int ret = Fl_Group::handle(e);
|
||||
if ( ! _root ) return(ret);
|
||||
switch ( e ) {
|
||||
case FL_PUSH: {
|
||||
lastselect = 0;
|
||||
item_clicked(0); // assume no item was clicked
|
||||
Fl_Tree_Item *o = _root->find_clicked(_prefs);
|
||||
if ( o ) {
|
||||
ret |= 1; // handled
|
||||
if ( Fl::event_button() == FL_LEFT_MOUSE ) {
|
||||
// Was collapse icon clicked?
|
||||
if ( o->event_on_collapse_icon(_prefs) ) {
|
||||
o->open_toggle();
|
||||
redraw();
|
||||
}
|
||||
// Item's label clicked?
|
||||
else if ( o->event_on_label(_prefs) &&
|
||||
(!o->widget() || !Fl::event_inside(o->widget())) &&
|
||||
callback() &&
|
||||
(!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) {
|
||||
item_clicked(o); // save item clicked
|
||||
// Handle selection behavior
|
||||
switch ( _prefs.selectmode() ) {
|
||||
case FL_TREE_SELECT_NONE: { // no selection changes
|
||||
break;
|
||||
}
|
||||
case FL_TREE_SELECT_SINGLE: {
|
||||
changed = select_only(o);
|
||||
break;
|
||||
}
|
||||
case FL_TREE_SELECT_MULTI: {
|
||||
int state = Fl::event_state();
|
||||
if ( state & FL_SHIFT ) {
|
||||
if ( ! o->is_selected() ) {
|
||||
o->select(); // add to selection
|
||||
changed = 1; // changed
|
||||
}
|
||||
} else if ( state & FL_CTRL ) {
|
||||
changed = 1; // changed
|
||||
o->select_toggle(); // toggle selection state
|
||||
lastselect = o; // save we toggled it (prevents oscillation)
|
||||
} else {
|
||||
changed = select_only(o);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( changed ) {
|
||||
redraw(); // make change(s) visible
|
||||
if ( when() & FL_WHEN_CHANGED ) {
|
||||
set_changed();
|
||||
do_callback((Fl_Widget*)this, user_data()); // item callback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FL_DRAG: {
|
||||
Fl_Tree_Item *o = _root->find_clicked(_prefs);
|
||||
if ( o ) {
|
||||
ret |= 1; // handled
|
||||
// Item's label clicked?
|
||||
if ( o->event_on_label(_prefs) &&
|
||||
(!o->widget() || !Fl::event_inside(o->widget())) &&
|
||||
callback() &&
|
||||
(!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) {
|
||||
item_clicked(o); // save item clicked
|
||||
// Handle selection behavior
|
||||
switch ( _prefs.selectmode() ) {
|
||||
case FL_TREE_SELECT_NONE: { // no selection changes
|
||||
break;
|
||||
}
|
||||
case FL_TREE_SELECT_SINGLE: {
|
||||
changed = select_only(o);
|
||||
break;
|
||||
}
|
||||
case FL_TREE_SELECT_MULTI: {
|
||||
int state = Fl::event_state();
|
||||
if ( state & FL_CTRL ) {
|
||||
if ( lastselect != o ) {// not already toggled from last microdrag?
|
||||
changed = 1; // changed
|
||||
o->select_toggle(); // toggle selection
|
||||
lastselect = o; // save we toggled it (prevents oscillation)
|
||||
redraw(); // make change(s) visible
|
||||
}
|
||||
} else {
|
||||
changed = 1; // changed
|
||||
o->select(); // select this
|
||||
redraw(); // make change(s) visible
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( changed ) {
|
||||
redraw(); // make change(s) visible
|
||||
if ( when() & FL_WHEN_CHANGED ) {
|
||||
set_changed();
|
||||
do_callback((Fl_Widget*)this, user_data()); // item callback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case FL_RELEASE: {
|
||||
if ( Fl::event_button() == FL_LEFT_MOUSE ) {
|
||||
ret |= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/// Deselect item and all its children.
|
||||
/// If item is NULL, root() is used.
|
||||
/// Handles calling redraw() if anything was changed.
|
||||
/// Returns count of how many items were in the 'selected' state,
|
||||
/// ie. how many items were "changed".
|
||||
///
|
||||
int Fl_Tree::deselect_all(Fl_Tree_Item *item) {
|
||||
item = item ? item : root(); // NULL? use root()
|
||||
int count = item->deselect_all();
|
||||
if ( count ) redraw(); // anything changed? cause redraw
|
||||
return(count);
|
||||
}
|
||||
|
||||
/// Select only this item.
|
||||
/// If item is NULL, root() is used.
|
||||
/// Handles calling redraw() if anything was changed.
|
||||
/// Returns how many items were changed, if any.
|
||||
///
|
||||
int Fl_Tree::select_only(Fl_Tree_Item *selitem) {
|
||||
selitem = selitem ? selitem : root(); // NULL? use root()
|
||||
int changed = 0;
|
||||
for ( Fl_Tree_Item *item = first(); item; item = item->next() ) {
|
||||
if ( item == selitem ) {
|
||||
if ( item->is_selected() ) continue; // don't count if already selected
|
||||
item->select();
|
||||
++changed;
|
||||
} else {
|
||||
if ( item->is_selected() ) {
|
||||
item->deselect();
|
||||
++changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( changed ) redraw(); // anything changed? redraw
|
||||
return(changed);
|
||||
}
|
||||
707
src/Fl_Tree_Item.cxx
Normal file
707
src/Fl_Tree_Item.cxx
Normal file
File diff suppressed because it is too large
Load Diff
149
src/Fl_Tree_Item_Array.cxx
Normal file
149
src/Fl_Tree_Item_Array.cxx
Normal file
@@ -0,0 +1,149 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <FL/Fl_Tree_Item_Array.H>
|
||||
#include <FL/Fl_Tree_Item.H>
|
||||
|
||||
//////////////////////
|
||||
// Fl_Tree_Item_Array.cxx
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
/// Constructor; creates an empty array.
|
||||
///
|
||||
/// The optional 'chunksize' can be specified to optimize
|
||||
/// memory allocation for potentially large arrays. Default chunksize is 10.
|
||||
///
|
||||
Fl_Tree_Item_Array::Fl_Tree_Item_Array(int new_chunksize) {
|
||||
_items = 0;
|
||||
_total = 0;
|
||||
_size = 0;
|
||||
_chunksize = new_chunksize;
|
||||
}
|
||||
|
||||
/// Destructor. Calls each item's destructor, destroys internal _items array.
|
||||
Fl_Tree_Item_Array::~Fl_Tree_Item_Array() {
|
||||
clear();
|
||||
}
|
||||
|
||||
/// Copy constructor. Makes new copy of array, with new instances of each item.
|
||||
Fl_Tree_Item_Array::Fl_Tree_Item_Array(const Fl_Tree_Item_Array* o) {
|
||||
_items = (Fl_Tree_Item**)malloc(o->_size * sizeof(Fl_Tree_Item*));
|
||||
_total = o->_total;
|
||||
_size = o->_size;
|
||||
_chunksize = o->_chunksize;
|
||||
for ( int t=0; t<o->_total; t++ ) {
|
||||
_items[t] = new Fl_Tree_Item(o->_items[t]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear the entire array.
|
||||
///
|
||||
/// Each item will be deleted (destructors will be called),
|
||||
/// and the array will be cleared. total() will return 0.
|
||||
///
|
||||
void Fl_Tree_Item_Array::clear() {
|
||||
if ( _items ) {
|
||||
for ( int t=0; t<_total; t++ ) {
|
||||
delete _items[t];
|
||||
_items[t] = 0;
|
||||
}
|
||||
free((void*)_items); _items = 0;
|
||||
}
|
||||
_total = _size = 0;
|
||||
}
|
||||
|
||||
// Internal: Enlarge the items array.
|
||||
//
|
||||
// Adjusts size/items memory allocation as needed.
|
||||
// Does NOT change total.
|
||||
//
|
||||
void Fl_Tree_Item_Array::enlarge(int count) {
|
||||
int newtotal = _total + count; // new total
|
||||
if ( newtotal >= _size ) { // more than we have allocated?
|
||||
// Increase size of array
|
||||
int newsize = _size + _chunksize;
|
||||
Fl_Tree_Item **newitems = (Fl_Tree_Item**)malloc(newsize * sizeof(Fl_Tree_Item*));
|
||||
if ( _items ) {
|
||||
// Copy old array -> new, delete old
|
||||
memmove(newitems, _items, _size * sizeof(Fl_Tree_Item*));
|
||||
free((void*)_items); _items = 0;
|
||||
}
|
||||
// Adjust items/sizeitems
|
||||
_items = newitems;
|
||||
_size = newsize;
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert an item at index position \p pos.
|
||||
///
|
||||
/// Handles enlarging array if needed, total increased by 1.
|
||||
/// If \p pos == total(), an empty item is appended to the array.
|
||||
///
|
||||
void Fl_Tree_Item_Array::insert(int pos, Fl_Tree_Item *new_item) {
|
||||
enlarge(1);
|
||||
// printf("*** POS=%d TOTAL-1=%d NITEMS=%d\n", pos, _total-1, (_total-pos));
|
||||
if ( pos <= (_total - 1) ) { // need to move memory around?
|
||||
int nitems = _total - pos;
|
||||
memmove(&_items[pos+1], &_items[pos], sizeof(Fl_Tree_Item*) * nitems);
|
||||
}
|
||||
_items[pos] = new_item;
|
||||
_total++;
|
||||
}
|
||||
|
||||
/// Add an item* to the end of the array.
|
||||
///
|
||||
/// Assumes the item was created with 'new', and will remain
|
||||
/// allocated.. Fl_Tree_Item_Array will handle calling the
|
||||
/// item's destructor when the array is cleared or the item remove()'ed.
|
||||
///
|
||||
void Fl_Tree_Item_Array::add(Fl_Tree_Item *val) {
|
||||
insert(_total, val);
|
||||
}
|
||||
|
||||
/// Remove the item at \param[in] index from the array.
|
||||
///
|
||||
/// The item will be delete'd (if non-NULL), so its destructor will be called.
|
||||
///
|
||||
void Fl_Tree_Item_Array::remove(int index) {
|
||||
if ( _items[index] ) { // delete if non-zero
|
||||
delete _items[index];
|
||||
}
|
||||
_items[index] = 0;
|
||||
for ( _total--; index<_total; index++ ) {
|
||||
_items[index] = _items[index+1];
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove the item from the array.
|
||||
///
|
||||
/// \returns 0 if removed, or -1 if the item was not in the array.
|
||||
///
|
||||
int Fl_Tree_Item_Array::remove(Fl_Tree_Item *item) {
|
||||
for ( int t=0; t<_total; t++ ) {
|
||||
if ( item == _items[t] ) {
|
||||
remove(t);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
122
src/Fl_Tree_Prefs.cxx
Normal file
122
src/Fl_Tree_Prefs.cxx
Normal file
@@ -0,0 +1,122 @@
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/Fl_Tree_Prefs.H>
|
||||
#include <string.h>
|
||||
|
||||
//////////////////////
|
||||
// Fl_Tree_Prefs.cxx
|
||||
//////////////////////
|
||||
//
|
||||
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
|
||||
// Copyright (C) 2009 by Greg Ercolano.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// INTERNAL: BUILT IN OPEN/STOW XPMS
|
||||
// These can be replaced via prefs.openicon()/closeicon()
|
||||
//
|
||||
static const char *L_open_xpm[] = {
|
||||
"11 11 3 1",
|
||||
". c #fefefe",
|
||||
"# c #444444",
|
||||
"@ c #000000",
|
||||
"###########",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#....@....#",
|
||||
"#....@....#",
|
||||
"#..@@@@@..#",
|
||||
"#....@....#",
|
||||
"#....@....#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"###########"};
|
||||
static Fl_Pixmap L_openpixmap(L_open_xpm);
|
||||
|
||||
static const char *L_close_xpm[] = {
|
||||
"11 11 3 1",
|
||||
". c #fefefe",
|
||||
"# c #444444",
|
||||
"@ c #000000",
|
||||
"###########",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#..@@@@@..#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"#.........#",
|
||||
"###########"};
|
||||
static Fl_Pixmap L_closepixmap(L_close_xpm);
|
||||
|
||||
/// Sets the default icon to be used as the 'open' icon
|
||||
/// when items are add()ed to the tree.
|
||||
/// This overrides the built in default '[+]' icon.
|
||||
///
|
||||
/// \param[in] val -- The new pixmap, or zero to use the default [+] icon.
|
||||
///
|
||||
void Fl_Tree_Prefs::openicon(Fl_Pixmap *val) {
|
||||
_openpixmap = val ? val : &L_openpixmap;
|
||||
}
|
||||
|
||||
/// Sets the icon to be used as the 'close' icon.
|
||||
/// This overrides the built in default '[-]' icon.
|
||||
///
|
||||
/// \param[in] val -- The new pixmap, or zero to use the default [-] icon.
|
||||
///
|
||||
void Fl_Tree_Prefs::closeicon(Fl_Pixmap *val) {
|
||||
_closepixmap = val ? val : &L_closepixmap;
|
||||
}
|
||||
|
||||
/// Fl_Tree_Prefs constructor
|
||||
Fl_Tree_Prefs::Fl_Tree_Prefs() {
|
||||
_labelfont = FL_HELVETICA;
|
||||
_labelsize = FL_NORMAL_SIZE;
|
||||
_marginleft = 6;
|
||||
_margintop = 3;
|
||||
//_marginright = 3;
|
||||
//_marginbottom = 3;
|
||||
_openchild_marginbottom = 0;
|
||||
_usericonmarginleft = 3;
|
||||
_labelmarginleft = 3;
|
||||
_linespacing = 0;
|
||||
_fgcolor = FL_BLACK;
|
||||
_bgcolor = FL_WHITE;
|
||||
_selectcolor = FL_DARK_BLUE;
|
||||
_inactivecolor = FL_GRAY;
|
||||
_connectorcolor = Fl_Color(43);
|
||||
_connectorstyle = FL_TREE_CONNECTOR_DOTTED;
|
||||
_openpixmap = &L_openpixmap;
|
||||
_closepixmap = &L_closepixmap;
|
||||
_userpixmap = 0;
|
||||
_showcollapse = 1;
|
||||
_showroot = 1;
|
||||
_connectorwidth = 17;
|
||||
_sortorder = FL_TREE_SORT_NONE;
|
||||
_selectbox = FL_FLAT_BOX;
|
||||
_selectmode = FL_TREE_SELECT_SINGLE;
|
||||
// Let fltk's current 'scheme' affect defaults
|
||||
if ( Fl::scheme() ) {
|
||||
if ( strcmp(Fl::scheme(), "gtk+") == 0 ) {
|
||||
_selectbox = _FL_GTK_THIN_UP_BOX;
|
||||
} else if ( strcmp(Fl::scheme(), "plastic") == 0 ) {
|
||||
_selectbox = _FL_PLASTIC_THIN_UP_BOX;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,10 @@ CPPFILES = \
|
||||
Fl_Text_Editor.cxx \
|
||||
Fl_Tile.cxx \
|
||||
Fl_Tiled_Image.cxx \
|
||||
Fl_Tree.cxx \
|
||||
Fl_Tree_Item.cxx \
|
||||
Fl_Tree_Item_Array.cxx \
|
||||
Fl_Tree_Prefs.cxx \
|
||||
Fl_Tooltip.cxx \
|
||||
Fl_Valuator.cxx \
|
||||
Fl_Value_Input.cxx \
|
||||
|
||||
1443
src/makedepend
1443
src/makedepend
File diff suppressed because it is too large
Load Diff
@@ -95,6 +95,7 @@ CPPFILES =\
|
||||
threads.cxx \
|
||||
tile.cxx \
|
||||
tiled_image.cxx \
|
||||
tree.cxx \
|
||||
valuators.cxx \
|
||||
utf8.cxx
|
||||
|
||||
@@ -158,6 +159,7 @@ ALL = \
|
||||
$(THREADS) \
|
||||
tile$(EXEEXT) \
|
||||
tiled_image$(EXEEXT) \
|
||||
tree$(EXEEXT) \
|
||||
valuators$(EXEEXT) \
|
||||
cairotest$(EXEEXT) \
|
||||
utf8$(EXEEXT)
|
||||
@@ -420,6 +422,8 @@ sudoku.exe: sudoku.o sudoku.rc
|
||||
|
||||
symbols$(EXEEXT): symbols.o
|
||||
|
||||
table$(EXEEXT): table.o
|
||||
|
||||
tabs$(EXEEXT): tabs.o
|
||||
tabs.cxx: tabs.fl ../fluid/fluid$(EXEEXT)
|
||||
|
||||
@@ -432,6 +436,8 @@ tile$(EXEEXT): tile.o
|
||||
|
||||
tiled_image$(EXEEXT): tiled_image.o
|
||||
|
||||
tree$(EXEEXT): tree.o
|
||||
|
||||
valuators$(EXEEXT): valuators.o
|
||||
valuators.cxx: valuators.fl ../fluid/fluid$(EXEEXT)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
@x:more...:@xm
|
||||
@xm:Fl_Menu:menubar
|
||||
@xm:Fl_Table:table
|
||||
@xm:Fl_Tree:tree
|
||||
|
||||
@main:Window\nTests:@w
|
||||
@w:overlay:overlay
|
||||
|
||||
921
test/makedepend
921
test/makedepend
File diff suppressed because it is too large
Load Diff
642
test/tree.cxx
Normal file
642
test/tree.cxx
Normal file
File diff suppressed because it is too large
Load Diff
41
test/tree.h
Normal file
41
test/tree.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// generated by Fast Light User Interface Designer (fluid) version 1.0300
|
||||
|
||||
#ifndef test_Fl_Tree_H
|
||||
#define test_Fl_Tree_H
|
||||
#include <FL/Fl.H>
|
||||
#include <stdio.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Tree.H>
|
||||
#include <FL/fl_ask.h>
|
||||
void CccButton_CB(Fl_Widget*, void*data);
|
||||
void RebuildTree();
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
extern Fl_Double_Window *window;
|
||||
extern Fl_Tree *tree;
|
||||
#include <FL/Fl_Value_Slider.H>
|
||||
extern Fl_Value_Slider *labelsize_slider;
|
||||
extern Fl_Value_Slider *connectorwidth_slider;
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *usericon_radio;
|
||||
#include <FL/Fl_Choice.H>
|
||||
extern Fl_Choice *collapseicons_chooser;
|
||||
extern Fl_Choice *connectorstyle_chooser;
|
||||
extern Fl_Choice *labelcolor_chooser;
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Light_Button.H>
|
||||
extern Fl_Light_Button *selectall_toggle;
|
||||
extern Fl_Light_Button *bold_toggle;
|
||||
extern Fl_Light_Button *bbbselect_toggle;
|
||||
extern Fl_Value_Slider *margintop_slider;
|
||||
extern Fl_Value_Slider *marginleft_slider;
|
||||
extern Fl_Light_Button *deactivate_toggle;
|
||||
extern Fl_Check_Button *showroot_radio;
|
||||
extern Fl_Choice *selectmode_chooser;
|
||||
extern Fl_Value_Slider *openchild_marginbottom_slider;
|
||||
extern Fl_Menu_Item menu_collapseicons_chooser[];
|
||||
extern Fl_Menu_Item menu_connectorstyle_chooser[];
|
||||
extern Fl_Menu_Item menu_labelcolor_chooser[];
|
||||
extern Fl_Menu_Item menu_selectmode_chooser[];
|
||||
#endif
|
||||
Reference in New Issue
Block a user