diff options
author | fluxgen <fluxgen> | 2003-08-18 12:15:39 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-18 12:15:39 (GMT) |
commit | 443874957b66380a6017314cb7fd6ad40df79f2a (patch) | |
tree | 57981cd682d9d9fb4aefcb02bbee32172ce7aac3 /src/FbTk/TextButton.hh | |
parent | 8bf640a79948368a9bb325af6176a1676ef36b71 (diff) | |
download | fluxbox-443874957b66380a6017314cb7fd6ad40df79f2a.zip fluxbox-443874957b66380a6017314cb7fd6ad40df79f2a.tar.bz2 |
moved from fluxbox main source
Diffstat (limited to 'src/FbTk/TextButton.hh')
-rw-r--r-- | src/FbTk/TextButton.hh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/FbTk/TextButton.hh b/src/FbTk/TextButton.hh new file mode 100644 index 0000000..fa1149d --- /dev/null +++ b/src/FbTk/TextButton.hh | |||
@@ -0,0 +1,67 @@ | |||
1 | // TextButton.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen[at]fluxbox.org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: TextButton.hh,v 1.1 2003/08/18 12:15:38 fluxgen Exp $ | ||
23 | |||
24 | #ifndef FBTK_TEXTBUTTON_HH | ||
25 | #define FBTK_TEXTBUTTON_HH | ||
26 | |||
27 | #include "Button.hh" | ||
28 | #include "Text.hh" | ||
29 | |||
30 | #include <string> | ||
31 | |||
32 | namespace FbTk { | ||
33 | |||
34 | class Font; | ||
35 | |||
36 | /// Displays a text on a button | ||
37 | class TextButton: public FbTk::Button { | ||
38 | public: | ||
39 | TextButton(const FbTk::FbWindow &parent, | ||
40 | const FbTk::Font &font, const std::string &text); | ||
41 | |||
42 | void setJustify(FbTk::Justify just); | ||
43 | void setText(const std::string &text); | ||
44 | void setFont(const FbTk::Font &font); | ||
45 | void setBevel(int bevel); | ||
46 | /// clears window and redraw text | ||
47 | void clear(); | ||
48 | |||
49 | inline FbTk::Justify justify() const { return m_justify; } | ||
50 | inline const std::string &text() const { return m_text; } | ||
51 | inline const FbTk::Font &font() const { return *m_font; } | ||
52 | unsigned int textWidth() const; | ||
53 | int bevel() const { return m_bevel; } | ||
54 | |||
55 | protected: | ||
56 | void drawText(int x_offset = 0, int y_offset = 0); | ||
57 | |||
58 | private: | ||
59 | const FbTk::Font *m_font; | ||
60 | std::string m_text; | ||
61 | FbTk::Justify m_justify; | ||
62 | int m_bevel; | ||
63 | }; | ||
64 | |||
65 | }; // end namespace FbTk | ||
66 | |||
67 | #endif // FBTK_TEXTBUTTON_HH | ||