Fl_OpDesk
Fl_OpConnect.H
Go to the documentation of this file.
00001 #ifndef _FL_OPCONNECT_H_
00002 #define _FL_OPCONNECT_H_
00003 
00004 //INSERT-LGPL-HEADER-HERE//
00005 
00010 
00011 #include "Fl_OpButton.H"
00012 
00013 class Fl_OpButton;
00014 
00029 class Fl_OpConnect {
00030     Fl_OpButton *srcbut;                // source button
00031     Fl_OpButton *dstbut;                // destination button
00032     Fl_Color  color;            // connection color
00033     int       width;            // connection width
00034 
00035 public:
00037     Fl_OpConnect(Fl_OpButton *a, Fl_OpButton *b) {
00038         srcbut = a;
00039         dstbut = b;
00040         color = Fl_Color(0xf0d0a000);           // whiteish
00041         width = 2;
00042     }
00043 
00045     void operator=(const Fl_OpConnect& o) {
00046         srcbut = o.srcbut;
00047         dstbut = o.dstbut;
00048         color = o.color;
00049         width = o.width;
00050     }
00051 
00053     Fl_OpConnect(const Fl_OpConnect& o) {
00054         *this = o;      // let assignment handle copy
00055     }
00056 
00060     int IsButtonConnected(Fl_OpButton *find) {
00061         return((srcbut==find || dstbut==find) ? 1 : 0);
00062     }
00063 
00067     int AreConnected(Fl_OpButton *a, Fl_OpButton *b) {
00068        return( ((srcbut==a && dstbut==b) || (srcbut==b && dstbut==a)) ? 1 : 0);
00069     }
00070 
00072     Fl_OpButton *GetSrcButton() const {
00073         return(srcbut);
00074     }
00075 
00077     Fl_OpButton *GetDstButton() const {
00078         return(dstbut);
00079     }
00080 
00082     Fl_Color GetColor() const {
00083         return(color);
00084     }
00085 
00087     void SetColor(Fl_Color val) {
00088         color = val;
00089     }
00090 
00092     int GetWidth() const {
00093         return(width);
00094     }
00095 
00097     void SetWidth(int val) {
00098         width = val;
00099     }
00100 
00102     void CopyAttributes(Fl_OpConnect *old) {
00103         SetColor(old->GetColor());
00104         SetWidth(old->GetWidth());
00105     }
00106 };
00107 #endif /* _FL_OPCONNECT_H_ */