⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flu_tree_browser.h

📁 ncbi源码
💻 H
📖 第 1 页 / 共 4 页
字号:
      //! Get the unique ID of this node      inline unsigned int id() const	{ return _id; }      //! Get the index this node is (as a child) in its parent's list      /*! \return -1 if this node has no parent, else its index in its parent's list of children */      int index() const;      //! Is node \b n an ancestor of this node?      bool is_ancestor( Node* n );      //! Is this node a branch node?      bool is_branch() const;      //! Is node \b n a descendent of this node?      bool is_descendent( Node* n );      //! Is this node a leaf node?      bool is_leaf() const;      //! Is this node the root node?      inline bool is_root() const	{ return( _parent == 0 ); }      //! Set the label for this node. Note that setting the label may invalidate a sorted tree. Fix by calling Flu_Tree_Browser::sort()       inline void label( const char *l )	{ text = l; tree->redraw(); }      //! Get the label for this node      inline const char* label() const	{ return text.c_str(); }      //! Set the label color for this node      inline void label_color( Fl_Color c )	{ textColor = c; }      //! Get the label color for this node      inline Fl_Color label_color() const	{ return textColor; }      //! Set the label font for this node      inline void label_font( Fl_Font f )	{ textFont = f; tree->rdata.forceResize = true; }      //! Get the label font for this node      inline Fl_Font label_font() const	{ return textFont; }      //! Set the label size for this node      inline void label_size( unsigned char s )	{ textSize = s; tree->rdata.forceResize = true; }      //! Get the label size for this node      inline unsigned char label_size() const	{ return textSize; }      //! Is the label for this node visible?      inline bool label_visible() const	{ return CHECK(SHOW_LABEL); }      //! Set whether the label for this node is visible      inline void label_visible( bool b )	{ SET(SHOW_LABEL,b); tree->rdata.forceResize = true; }      //! \return the last node in this hierarchy      Node* last();      //! \return the last branch encountered in a depth-first traversal (or this node if it is a branch and has no children). NULL means there are no branches      Node* last_branch();      //! \return the last leaf encountered in a depth-first traversal (or this node if it is a leaf). NULL means there are no leaves      Node* last_leaf();      //! Set the leaf icon to use for this node (only for leaf nodes)      void leaf_icon( Fl_Image *icon );      //! Set whether this node can be moved (either via move() or by dragging with the mouse). Default is \c true      inline void movable( bool b )	{ SET(MOVABLE,b); }      //! Get whether this node can be moved (either via move() or by dragging with the mouse)      inline bool movable()	{ return CHECK(MOVABLE); }      //! Move this node to a position before, after, or inside node \b n      /*! \param where can be one of MOVE_BEFORE, MOVE_AFTER, or MOVE_INSIDE	\return \c true if the move was successful, or \c false if the move is not allowed       */      inline bool move( int where, Node* n )	{ return( move( this, where, n ) ); }      //! Move node \b n1 to a position before, after, or inside node \b n2      /*! \param where can be one of MOVE_BEFORE, MOVE_AFTER, or MOVE_INSIDE	\return \c true if the move was successful, or \c false if the move is not allowed       */      static bool move( Node* n1, int where, Node* n2 );      //! \return the next node (after this node) in this hierarchy (depth-first traversal)      Node* next();      //! \return the next branch (after this node) encountered in a depth-first traversal. NULL means there are no more branches      Node* next_branch();      //! \return the next leaf (after this node) encountered in a depth-first traversal. NULL means there are no more leaves      Node* next_leaf();      //! \return the next sibling (after this node) encountered in a depth-first traversal. NULL means this node is the last child w.r.t. its parent      Node* next_sibling();      //! Is this node currently open? (only for branch nodes)      inline bool open() const	{ return( !CHECK(COLLAPSED) || tree->rdata.allBranchesAlwaysOpen ); }      //! Open or close this node (only for branch nodes)      void open( bool b );      //! Get the node that is the parent of this node, or NULL if there is no parent      inline Node* parent() const	{ return _parent; }      //! \return the previous node (before this node) in this hierarchy (depth-first traversal)      Node* previous();      //! \return the previous branch (before this node) encountered in a depth-first traversal. NULL means there are no more branches      Node* previous_branch();      //! \return the previous leaf (before this node) encountered in a depth-first traversal. NULL means there are no more leaves      Node* previous_leaf();      //! \return the previous sibling (before this node) encountered in a depth-first traversal. NULL means this node is the first child w.r.t. its parent      Node* previous_sibling();      //! Print this node and its children to stdout      void print( int spaces = 0 );      //! Remove the entry identified by path \b fullpath from this node      /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */      inline unsigned int remove( const char *fullpath )	{ return( reinterpret_cast<long>(modify( fullpath, REMOVE, tree->rdata )) ); }      //! Remove the entry identified by unique id \b id from this node      /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */      unsigned int remove( unsigned int id );      //! Remove the entry containing the widget \b w from this node. Note that the widget is automatically destroyed      /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */      unsigned int remove( Fl_Widget *w );      //! Remove Node \b n      /*! \return the id of \b n on successful removal, or \c 0 if \b n is present */      inline unsigned int remove( Node* n )	{ if( !n ) return 0; else return remove( n->id() ); }      //! Select this entry and all child entries      void select_all();      //! Is this node currently selected?      inline bool selected() const	{ return CHECK(SELECTED); }      //! Select or unselect this node      void select( bool b );      //! Sort this node's children according to Flu_Tree_Browser::insertion_mode()      inline void sort_children()	{ sort(); }      //! Unselect this entry and all child entries (except for Node \b except )      void unselect_all( Node* except = NULL );      //! Get the user-specific data stored in this node      inline void* user_data()	{ return userData; }      //! Set the user-specific data stored in this node      inline void user_data( void *d )	{ userData = d; }      //! Get the widget in this node, or NULL if there is no widget. Note that the widget is destroyed by the tree/node on clear() or the destructor      inline Fl_Widget* widget() const	{ return( _widget ? _widget->w : NULL ); }      //! Set the widget in this node. Note that the widget is destroyed by the tree/node on clear() or the destructor      void widget( Fl_Widget *w );    protected:      friend class Flu_Tree_Browser;      friend class NodeList;      // Root node constructor      Node( const char *lbl = 0 );      // Non-root constructor      Node( bool l, const char* n, Node *p, RData &rdata, Fl_Widget *w, bool showLabel );      ~Node();      // add/remove/find/get      Node* modify( const char* path, int what, RData &rdata, Fl_Widget *w = 0, bool showLabel = true );      void initType();      void sort();      void determineVisibility( bool parentVisible = true );      static bool isMoveValid( Node* &n1, int &where, Node* &n2 );      // handle/draw/measure/count      int recurse( RData &rdata, int type, int event = 0 );      void draw( RData &rdata, bool measure );      // recursively finding the full path of the node identified by id      bool findPath( unsigned int id, RData &rdata );      // recursively finding the full path of the node containing w      bool findPath( Fl_Widget *w, RData &rdata );      class NCBI_GUIWIDGETS_FLU_EXPORT WidgetInfo	{	public:	  Fl_Widget *w;	  int defaultW;  // the initial width of the widget	  void (*CB)(Fl_Widget*,void*);	  void *CBData;	};      unsigned int _id; // the unique id of this node      unsigned short flags;      NodeList _children;      Node *_parent;      Flu_Tree_Browser *tree;      FluSimpleString text;      WidgetInfo *_widget;  // memory overhead deferred to WidgetInfo. present only if widget is      void *userData;      int totalChildH; // needed for animation      Fl_Image *cIcon[2], *bIcon[2], *lIcon;      Fl_Color textColor;      Fl_Font textFont;      unsigned char textSize;  // the font size of the entry label text      unsigned short textW, textH;  // how big the entry label actually is (stored within the node for performance reasons)      int currentY; // needed for animation      unsigned short currentH;      inline static void _widgetCB( Fl_Widget* w, void* arg )	{ ((Node*)arg)->widgetCB(); }      void widgetCB();     }; protected:  inline static void _scrollCB( Fl_Widget* w, void* arg )    { ((Flu_Tree_Browser*)arg)->redraw(); }  inline static void _timerRedrawCB( void *arg )    { ((Flu_Tree_Browser*)arg)->timerRedrawCB(); }  void timerRedrawCB();  inline static void _timerScrollCB( void *arg )    { ((Flu_Tree_Browser*)arg)->timerScrollCB(); }  void timerScrollCB();  void on_dnd_leave();  void on_dnd_release();  bool on_dnd_drag( int X, int Y );  void on_dnd_drop( const Flu_DND_Event *e );  /* override of Fl_Double_Window::draw() */  void draw();  Fl_Group *scrollBox;  Fl_Scrollbar *scrollH, *scrollV;  Fl_Group *_box;  Node root;  RData rdata;  int lastEvent;  float autoScrollX, autoScrollY;  bool scrolledTimerOn;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -