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 selected; // 1=selected, 0=deselected 00052 std::vector<Fl_OpButton*> inputs; // input buttons 00053 std::vector<Fl_OpButton*> outputs; // output buttons 00054 Fl_OpDesk *opdesk; // parent opdesk 00055 00056 protected: 00057 // These are used by Fl_OpButton ctors/dtors only 00058 friend class Fl_OpButton; 00059 void _AddInputButton(Fl_OpButton*); 00060 void _AddOutputButton(Fl_OpButton*); 00061 void _RemoveButton(Fl_OpButton*); 00062 void _RecalcButtonSizes(); 00063 00064 public: 00065 // CTORS 00066 Fl_OpBox(int X,int Y,int W,int H,const char*L); 00067 ~Fl_OpBox(); 00068 Fl_OpBox(const Fl_OpBox& o); 00069 00071 int GetTitleHeight() const { 00072 return(labelsize() + 6); 00073 } 00074 00075 // FLTK 00076 int handle(int); 00077 void draw(); 00078 00079 // MINIMUM BUTTON/BOX HEIGHT 00080 00082 void SetMinimumButtonWidth(int val) { 00083 min_buttw = val; 00084 } 00085 00087 int GetMinimumButtonWidth() const { 00088 return(min_buttw); 00089 } 00090 00092 void SetMinimumBoxHeight(int val) { 00093 min_boxh = val; 00094 } 00095 00097 int GetMinimumBoxHeight() const { 00098 return(min_boxh); 00099 } 00100 00102 int GetSelected() const { 00103 return(selected); 00104 } 00105 00107 void SetSelected(int val) { 00108 selected = val; 00109 } 00110 00111 // INPUT BUTTON ACCESS 00112 int GetTotalInputButtons() const; 00113 Fl_OpButton *GetInputButton(int index) const; 00114 int GetIndexForInputButton(Fl_OpButton*) const; 00115 00116 // OUTPUT BUTTON ACCESS 00117 int GetTotalOutputButtons() const; 00118 Fl_OpButton *GetOutputButton(int index) const; 00119 int GetIndexForOutputButton(Fl_OpButton*) const; 00120 00121 // ALL BUTTON ACCESS 00122 int GetTotalButtons() const; 00123 Fl_OpButton *GetButton(int index) const; 00124 int GetIndexForButton(Fl_OpButton*) const; 00125 00126 // MISC 00127 Fl_OpButton* FindButtonByLabel(const std::string& lname, std::string& errmsg); 00128 Fl_OpButton* FindButtonUnderMouse(); 00129 void BringToFront(); 00130 void CopyButtons(const Fl_OpBox& o); 00131 00132 // PARENT ACCESS 00133 Fl_OpDesk* GetOpDesk(); 00134 const Fl_OpDesk* GetOpDesk() const; 00135 }; 00136 #endif /* _FL_OPBOX_H_ */