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

FX7Segment.h
1 /********************************************************************************
2 * *
3 * 7 - S e g m e n t D i s p l a y W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2004,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FX7SEGMENT_H
22 #define FX7SEGMENT_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  SEVENSEGMENT_NORMAL = 0,
34  SEVENSEGMENT_SHADOW = 0x00080000
35  };
36 
37 
43 class FXAPI FX7Segment : public FXFrame {
44  FXDECLARE(FX7Segment)
45 protected:
46  FXString label; // Text being shown
47  FXString tip; // Tooltip
48  FXString help; // Help message
49  FXColor textColor; // Text color
50  FXint thickness; // Segment thickness
51  FXint cellwidth; // Width of cell
52  FXint cellheight; // height of cell
53 protected:
54  FX7Segment();
55 private:
56  FX7Segment(const FX7Segment&);
57  FX7Segment &operator=(const FX7Segment&);
58  void drawCells(FXDCWindow &dc,FXint x,FXint y,FXint cw,FXint ch);
59  void drawSegments(FXDCWindow &dc,FXint x,FXint y,FXint w,FXint h,FXuint segments);
60 public:
61  long onPaint(FXObject*,FXSelector,void*);
62  long onCmdSetValue(FXObject*,FXSelector,void*);
63  long onCmdSetIntValue(FXObject*,FXSelector,void*);
64  long onCmdGetIntValue(FXObject*,FXSelector,void*);
65  long onCmdSetLongValue(FXObject*,FXSelector,void*);
66  long onCmdGetLongValue(FXObject*,FXSelector,void*);
67  long onCmdSetRealValue(FXObject*,FXSelector,void*);
68  long onCmdGetRealValue(FXObject*,FXSelector,void*);
69  long onCmdSetStringValue(FXObject*,FXSelector,void*);
70  long onCmdGetStringValue(FXObject*,FXSelector,void*);
71  long onCmdSetHelp(FXObject*,FXSelector,void*);
72  long onCmdGetHelp(FXObject*,FXSelector,void*);
73  long onCmdSetTip(FXObject*,FXSelector,void*);
74  long onCmdGetTip(FXObject*,FXSelector,void*);
75  long onQueryHelp(FXObject*,FXSelector,void*);
76  long onQueryTip(FXObject*,FXSelector,void*);
77 public:
78 
80  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);
81 
83  virtual FXint getDefaultWidth();
84 
86  virtual FXint getDefaultHeight();
87 
89  void setText(const FXString& text);
90 
92  FXString getText() const { return label; }
93 
95  void setTextColor(FXColor clr);
96 
98  FXColor getTextColor() const { return textColor; }
99 
101  void setCellWidth(FXint w);
102  FXint getCellWidth() const { return cellwidth; }
103 
105  void setCellHeight(FXint h);
106  FXint getCellHeight() const { return cellheight; }
107 
109  void setThickness(FXint t);
110  FXint getThickness() const { return thickness; }
111 
113  void set7SegmentStyle(FXuint style);
114 
116  FXuint get7SegmentStyle() const;
117 
119  void setJustify(FXuint mode);
120 
122  FXuint getJustify() const;
123 
125  void setHelpText(const FXString& text){ help=text; }
126 
128  const FXString& getHelpText() const { return help; }
129 
131  void setTipText(const FXString& text){ tip=text; }
132 
134  const FXString& getTipText() const { return tip; }
135 
137  virtual void save(FXStream &store) const;
138 
140  virtual void load(FXStream &store);
141  };
142 
143 }
144 
145 #endif

Copyright © 1997-2016 Jeroen van der Zijp