diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-04 13:20:35 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-06 15:09:30 (GMT) |
commit | cc80230bd85dbaf1036b4cf37259d3146229fb00 (patch) | |
tree | e990270246cf1b07bf5eb6c6ba1ebcd71c9dd8b9 /src/FbTk | |
parent | 59d9b0703ba8efb24893528f2eb9c84aaa8f5f83 (diff) | |
download | fluxbox-cc80230bd85dbaf1036b4cf37259d3146229fb00.zip fluxbox-cc80230bd85dbaf1036b4cf37259d3146229fb00.tar.bz2 |
expose a preferredWidth of *Button's
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Button.hh | 2 | ||||
-rw-r--r-- | src/FbTk/TextButton.cc | 4 | ||||
-rw-r--r-- | src/FbTk/TextButton.hh | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/FbTk/Button.hh b/src/FbTk/Button.hh index 1f65799..c3276a6 100644 --- a/src/FbTk/Button.hh +++ b/src/FbTk/Button.hh | |||
@@ -55,6 +55,8 @@ public: | |||
55 | virtual void setBackgroundColor(const Color &color); | 55 | virtual void setBackgroundColor(const Color &color); |
56 | virtual bool setOrientation(FbTk::Orientation orient) { return orient == FbTk::ROT0; } | 56 | virtual bool setOrientation(FbTk::Orientation orient) { return orient == FbTk::ROT0; } |
57 | 57 | ||
58 | virtual unsigned int preferredWidth() const { return width(); } | ||
59 | |||
58 | /** | 60 | /** |
59 | @name eventhandlers | 61 | @name eventhandlers |
60 | */ | 62 | */ |
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 4d05ecd..0cc1b51 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc | |||
@@ -112,6 +112,10 @@ unsigned int TextButton::textWidth() const { | |||
112 | return font().textWidth(text()); | 112 | return font().textWidth(text()); |
113 | } | 113 | } |
114 | 114 | ||
115 | unsigned int TextButton::preferredWidth() const { | ||
116 | return m_bevel + m_left_padding + m_right_padding + textWidth(); | ||
117 | } | ||
118 | |||
115 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { | 119 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { |
116 | // (win should always be *this, no need to check) | 120 | // (win should always be *this, no need to check) |
117 | drawText(0, 0, &drawable); | 121 | drawText(0, 0, &drawable); |
diff --git a/src/FbTk/TextButton.hh b/src/FbTk/TextButton.hh index fe92cc3..90c7c3d 100644 --- a/src/FbTk/TextButton.hh +++ b/src/FbTk/TextButton.hh | |||
@@ -62,6 +62,7 @@ public: | |||
62 | unsigned int textWidth() const; | 62 | unsigned int textWidth() const; |
63 | int bevel() const { return m_bevel; } | 63 | int bevel() const { return m_bevel; } |
64 | 64 | ||
65 | virtual unsigned int preferredWidth() const; | ||
65 | 66 | ||
66 | protected: | 67 | protected: |
67 | virtual void drawText(int x_offset, int y_offset, FbDrawable *drawable_override); | 68 | virtual void drawText(int x_offset, int y_offset, FbDrawable *drawable_override); |