Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXDynamicLabel.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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/****************************************************************************/
18// Text label with dynamic multi-line text (inserts line breaks on the fly)
19/****************************************************************************/
20
21#include <string>
22
23#include "fxheader.h"
24
25
27class MFXDynamicLabel : public FXLabel {
29 FXDECLARE(MFXDynamicLabel)
30
31public:
33 enum {
35 };
36
38 MFXDynamicLabel(FXComposite* p, const FXString& text, FXIcon* ic = 0, FXuint opts = LABEL_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, std::string indent = "- ");
39
40 virtual ~MFXDynamicLabel() {};
41
43 void setText(const FXString& text);
44
46 long onUpdate(FXObject* sender, FXSelector, void*);
47
49 void position(FXint x, FXint y, FXint w, FXint h);
50
51 FXint getDefaultHeight();
52
53protected:
56
57private:
58 void computeIndentation();
59 void reformatLineBreaks(const int curWidth);
60
61 std::string myOriginalString;
62 std::string myIndentString;
65};
A list item which allows for custom coloring.
void reformatLineBreaks(const int curWidth)
MFXDynamicLabel()
fox needs this
void setText(const FXString &text)
overload text label updates to store the original string as backup for when width changes again
void position(FXint x, FXint y, FXint w, FXint h)
overload position to be informed when the parent has done the layout
virtual ~MFXDynamicLabel()
long onUpdate(FXObject *sender, FXSelector, void *)
overload to be informed when the label text has to be reformatted due to width changes
std::string myOriginalString
std::string myIndentString