Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2004-2025 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file MFXLCDLabel.h
15 : /// @author Mathew Robertson
16 : /// @author Daniel Krajzewicz
17 : /// @author Michael Behrisch
18 : /// @author Pablo Alvarez Lopez
19 : /// @date 2004-03-19
20 : ///
21 : //
22 : /****************************************************************************/
23 : #pragma once
24 : #include <config.h>
25 :
26 : #include "fxheader.h"
27 :
28 : // ===========================================================================
29 : // class declaration
30 : // ===========================================================================
31 :
32 : class MFXStaticToolTip;
33 :
34 : // ===========================================================================
35 : // class definitions
36 : // ===========================================================================
37 :
38 : class MFXLCDLabel : public FXHorizontalFrame {
39 : /// @brief FOX-declaration
40 0 : FXDECLARE(MFXLCDLabel)
41 :
42 : public:
43 : /// @brief LCD Label styles
44 : enum {
45 : LCDLABEL_NORMAL = FRAME_SUNKEN | FRAME_THICK,
46 : LCDLABEL_LEADING_ZEROS = 0x01000000 /// leading zero's on label - useful for integers
47 : };
48 :
49 : /// @brief call messages
50 : enum {
51 : ID_SEVENSEGMENT = FXHorizontalFrame::ID_LAST,
52 : ID_LAST
53 : };
54 :
55 : public:
56 : /// @brief constructor
57 : MFXLCDLabel(FXComposite* p, MFXStaticToolTip* staticToolTip, FXuint nfig, FXObject* tgt, FXSelector sel, FXuint opts = LCDLABEL_NORMAL, FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD, FXint hs = DEFAULT_PAD);
58 :
59 : /// @brief destructor
60 : virtual ~MFXLCDLabel();
61 :
62 : /// @brief create resrouces
63 : virtual void create();
64 :
65 : /// @brief detach resources
66 : virtual void detach();
67 :
68 : /// @brief destroy resources
69 : virtual void destroy();
70 :
71 : /// @brief manipulate text in LCD label
72 : void setText(FXString lbl);
73 :
74 : /// @brief get text
75 : FXString getText() const;
76 :
77 : /// @brief set forground color
78 : void setFgColor(FXColor clr);
79 :
80 : /// @brief get forground color
81 : FXColor getFgColor() const;
82 :
83 : /// @brief set background color
84 : void setBgColor(FXColor clr);
85 :
86 : /// @brief get background color
87 : FXColor getBgColor() const;
88 :
89 : /// @brief set segment horizontal length - must be more than twice the segment width
90 : void setHorizontal(const FXint len);
91 :
92 : /// @brief get segment horizontal length - must be more than twice the segment width
93 : FXint getHorizontal() const;
94 :
95 : /// @brief set segment vertical length - must be more than twice the segment width
96 : void setVertical(const FXint len);
97 :
98 : /// @brief get segment vertical length - must be more than twice the segment width
99 : FXint getVertical() const;
100 :
101 : /// @brief set segment width - must be less than half the segment length
102 : void setThickness(const FXint w);
103 :
104 : /// @brief get segment width - must be less than half the segment length
105 : FXint getThickness() const;
106 :
107 : /// @brief set groove width - must be less than segment width
108 : void setGroove(const FXint w);
109 :
110 : /// @brief get groove width - must be less than segment width
111 : FXint getGroove() const;
112 :
113 : /// @brief return minimum width
114 : virtual FXint getDefaultWidth();
115 :
116 : /// @brief return minimum height
117 : virtual FXint getDefaultHeight();
118 :
119 : /// @brief set tooltip text
120 : void setToolTipText(const FXString& text);
121 :
122 : /// @brief save resources
123 : virtual void save(FXStream& store) const;
124 :
125 : /// @brief load resources
126 : virtual void load(FXStream& store);
127 :
128 : /// @brief handle paint event
129 : long onPaint(FXObject*, FXSelector, void*);
130 :
131 : /// @brief called when mouse enter in MFXMenuButtonTooltip
132 : long onEnter(FXObject* obj, FXSelector sel, void* ptr);
133 :
134 : /// @brief called when mouse leaves in MFXMenuButtonTooltip
135 : long onLeave(FXObject* obj, FXSelector sel, void* ptr);
136 :
137 : /// @brief called when mouse motion in MFXMenuButtonTooltip
138 : long onMotion(FXObject* obj, FXSelector sel, void* ptr);
139 :
140 : /// @brief Update value from a message
141 : long onCmdSetValue(FXObject*, FXSelector, void* ptr);
142 :
143 : /// @brief Update int value from a message
144 : long onCmdSetIntValue(FXObject*, FXSelector, void* ptr);
145 :
146 : /// @brief Update real value from a message
147 : long onCmdSetRealValue(FXObject*, FXSelector, void* ptr);
148 :
149 : /// @brief Update string value from a message
150 : long onCmdSetStringValue(FXObject*, FXSelector, void* ptr);
151 :
152 : /// @brief Obtain int value from text field
153 : long onCmdGetIntValue(FXObject*, FXSelector, void* ptr);
154 :
155 : /// @brief Obtain real value from text field
156 : long onCmdGetRealValue(FXObject*, FXSelector, void* ptr);
157 :
158 : /// @brief Obtain string value from text field
159 : long onCmdGetStringValue(FXObject*, FXSelector, void* ptr);
160 :
161 : /// @brief redirect events to main window
162 : long onRedirectEvent(FXObject*, FXSelector, void* ptr);
163 :
164 : /// @brief let parent show tip if appropriate
165 : long onQueryTip(FXObject*, FXSelector, void* ptr);
166 :
167 : /// @brief let parent show help if appropriate
168 : long onQueryHelp(FXObject*, FXSelector, void* ptr);
169 :
170 : protected:
171 : /// @brief FOX constructor
172 0 : FOX_CONSTRUCTOR(MFXLCDLabel)
173 :
174 : /// @brief The currently shown label
175 : FXString myLabel;
176 :
177 : /// @brief The number of shown figuresi, greater than zero
178 : FXint myNFigures;
179 :
180 : /// @brief pointer to staticToolTip
181 : MFXStaticToolTip* myStaticToolTip;
182 :
183 : /// @brief toolTip text
184 : FXString myToolTipText;
185 :
186 : /// @brief Draw a string
187 : void drawString(const FXString& lbl);
188 : };
|