Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FX7Segment.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                7 - S e g m e n t   D i s p l a y   W i d g e t                *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2004,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FX7SEGMENT_H
00022 #define FX7SEGMENT_H
00023 
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027 
00028 
00029 namespace FX {
00030 
00032 enum {
00033   SEVENSEGMENT_NORMAL   = 0,            
00034   SEVENSEGMENT_SHADOW   = 0x00080000    
00035   };
00036 
00037 
00043 class FXAPI FX7Segment : public FXFrame {
00044   FXDECLARE(FX7Segment)
00045 protected:
00046   FXString label;       // Text being shown
00047   FXColor  textColor;   // Text color
00048   FXint    thickness;   // Segment thickness
00049   FXint    cellwidth;   // Width of cell
00050   FXint    cellheight;  // height of cell
00051   FXString tip;         // Tooltip
00052   FXString help;        // Help message
00053 protected:
00054   FX7Segment();
00055 private:
00056   FX7Segment(const FX7Segment&);
00057   FX7Segment &operator=(const FX7Segment&);
00058   void drawCells(FXDCWindow &dc,FXint x,FXint y,FXint cw,FXint ch);
00059   void drawSegments(FXDCWindow &dc,FXint x,FXint y,FXint w,FXint h,FXuint segments);
00060 public:
00061   long onPaint(FXObject*,FXSelector,void*);
00062   long onCmdSetValue(FXObject*,FXSelector,void*);
00063   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00064   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00065   long onCmdSetLongValue(FXObject*,FXSelector,void*);
00066   long onCmdGetLongValue(FXObject*,FXSelector,void*);
00067   long onCmdSetRealValue(FXObject*,FXSelector,void*);
00068   long onCmdGetRealValue(FXObject*,FXSelector,void*);
00069   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00070   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00071   long onCmdSetHelp(FXObject*,FXSelector,void*);
00072   long onCmdGetHelp(FXObject*,FXSelector,void*);
00073   long onCmdSetTip(FXObject*,FXSelector,void*);
00074   long onCmdGetTip(FXObject*,FXSelector,void*);
00075   long onQueryHelp(FXObject*,FXSelector,void*);
00076   long onQueryTip(FXObject*,FXSelector,void*);
00077 public:
00078 
00080   FX7Segment(FXComposite* p,const FXString& text,FXuint opts=SEVENSEGMENT_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00081 
00083   virtual FXint getDefaultWidth();
00084 
00086   virtual FXint getDefaultHeight();
00087 
00089   void setText(const FXString& text);
00090 
00092   FXString getText() const { return label; }
00093 
00095   void setTextColor(FXColor clr);
00096 
00098   FXColor getTextColor() const { return textColor; }
00099 
00101   void setCellWidth(FXint w);
00102   FXint getCellWidth() const { return cellwidth; }
00103 
00105   void setCellHeight(FXint h);
00106   FXint getCellHeight() const { return cellheight; }
00107 
00109   void setThickness(FXint t);
00110   FXint getThickness() const { return thickness; }
00111 
00113   void set7SegmentStyle(FXuint style);
00114 
00116   FXuint get7SegmentStyle() const;
00117 
00119   void setJustify(FXuint mode);
00120 
00122   FXuint getJustify() const;
00123 
00125   void setHelpText(const FXString& text){ help=text; }
00126 
00128   const FXString& getHelpText() const { return help; }
00129 
00131   void setTipText(const FXString& text){ tip=text; }
00132 
00134   const FXString& getTipText() const { return tip; }
00135 
00137   virtual void save(FXStream &store) const;
00138 
00140   virtual void load(FXStream &store);
00141   };
00142 
00143 }
00144 
00145 #endif

Copyright © 1997-2011 Jeroen van der Zijp