Fl_OpDesk
|
00001 #ifndef _FL_OPBOX_H_ 00002 #define _FL_OPBOX_H_ 00003 00004 //INSERT-LGPL-HEADER-HERE// 00005 00010 00011 #include <FL/Fl_Group.H> 00012 00013 #include <string> 00014 00015 #include "Fl_OpButton.H" 00016 00017 class Fl_OpButton; 00018 class Fl_OpDesk; 00019 00043 00044 class Fl_OpBox : public Fl_Group { 00045 int eventxy[2]; // used for dragging: last x/y event 00046 int dragging; // used for dragging 00047 int min_buttw; // minimum button width 00048 int min_boxh; // minimum box height 00049 int inbutt_w; // input button widths 00050 int outbutt_w; // output button widths 00051 int min_conlen; // minimum connector length 00052 int selected; // 1=selected, 0=deselected 00053 std::vector<Fl_OpButton*> inputs; // input buttons 00054 std::vector<Fl_OpButton*> outputs; // output buttons 00055 Fl_OpDesk *opdesk; // parent opdesk 00056 00057 protected: 00058 // These are used by Fl_OpButton ctors/dtors only 00059 friend class Fl_OpButton; 00060 void _AddInputButton(Fl_OpButton*); 00061 void _AddOutputButton(Fl_OpButton*); 00062 void _RemoveButton(Fl_OpButton*); 00063 void _RecalcButtonSizes(); 00064 00065 public: 00066 // CTORS 00067 Fl_OpBox(int X,int Y,int W,int H,const char*L); 00068 ~Fl_OpBox(); 00069 Fl_OpBox(const Fl_OpBox& o); 00070 00072 int GetTitleHeight() const { 00073 return(labelsize() + 6); 00074 } 00075 00076 // FLTK 00077 int handle(int); 00078 void draw(); 00079 00080 // MINIMUM BUTTON/BOX HEIGHT 00081 00083 void SetMinimumButtonWidth(int val) { 00084 min_buttw = val; 00085 } 00086 00088 int GetMinimumButtonWidth() const { 00089 return(min_buttw); 00090 } 00091 00093 void SetMinimumBoxHeight(int val) { 00094 min_boxh = val; 00095 } 00096 00098 int GetMinimumBoxHeight() const { 00099 return(min_boxh); 00100 } 00101 00103 void SetMinimumConnectLength(int val) { 00104 min_conlen = val; 00105 } 00106 00108 int GetMinimumConnectLength() const { 00109 return(min_conlen); 00110 } 00111 00113 int GetSelected() const { 00114 return(selected); 00115 } 00116 00118 void SetSelected(int val) { 00119 selected = val; 00120 } 00121 00122 // INPUT BUTTON ACCESS 00123 int GetTotalInputButtons() const; 00124 Fl_OpButton *GetInputButton(int index) const; 00125 int GetIndexForInputButton(Fl_OpButton*) const; 00126 00127 // OUTPUT BUTTON ACCESS 00128 int GetTotalOutputButtons() const; 00129 Fl_OpButton *GetOutputButton(int index) const; 00130 int GetIndexForOutputButton(Fl_OpButton*) const; 00131 00132 // ALL BUTTON ACCESS 00133 int GetTotalButtons() const; 00134 Fl_OpButton *GetButton(int index) const; 00135 int GetIndexForButton(Fl_OpButton*) const; 00136 00137 // MISC 00138 Fl_OpButton* FindButtonByLabel(const std::string& lname, std::string& errmsg); 00139 Fl_OpButton* FindButtonUnderMouse(); 00140 int FindButtonByPtr(Fl_OpButton *b) const; 00141 void BringToFront(); 00142 void CopyButtons(const Fl_OpBox& o); 00143 00144 // PARENT ACCESS 00145 Fl_OpDesk* GetOpDesk(); 00146 const Fl_OpDesk* GetOpDesk() const; 00147 }; 00148 #endif /* _FL_OPBOX_H_ */