fixed rendering problem on focused textbutton
This commit is contained in:
parent
9ffcd43e70
commit
884928264a
2 changed files with 61 additions and 26 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbWinFrame.cc,v 1.35 2003/08/13 09:34:40 fluxgen Exp $
|
// $Id: FbWinFrame.cc,v 1.36 2003/08/13 16:36:37 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbWinFrame.hh"
|
#include "FbWinFrame.hh"
|
||||||
#include "ImageControl.hh"
|
#include "ImageControl.hh"
|
||||||
|
@ -271,7 +271,7 @@ void FbWinFrame::removeAllButtons() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::addLabelButton(FbTk::Button &btn) {
|
void FbWinFrame::addLabelButton(TextButton &btn) {
|
||||||
LabelList::iterator found_it = find(m_labelbuttons.begin(),
|
LabelList::iterator found_it = find(m_labelbuttons.begin(),
|
||||||
m_labelbuttons.end(),
|
m_labelbuttons.end(),
|
||||||
&btn);
|
&btn);
|
||||||
|
@ -282,7 +282,7 @@ void FbWinFrame::addLabelButton(FbTk::Button &btn) {
|
||||||
m_labelbuttons.push_back(&btn);
|
m_labelbuttons.push_back(&btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::removeLabelButton(FbTk::Button &btn) {
|
void FbWinFrame::removeLabelButton(TextButton &btn) {
|
||||||
LabelList::iterator erase_it = remove(m_labelbuttons.begin(),
|
LabelList::iterator erase_it = remove(m_labelbuttons.begin(),
|
||||||
m_labelbuttons.end(),
|
m_labelbuttons.end(),
|
||||||
&btn);
|
&btn);
|
||||||
|
@ -293,7 +293,7 @@ void FbWinFrame::removeLabelButton(FbTk::Button &btn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) {
|
void FbWinFrame::moveLabelButtonLeft(const TextButton &btn) {
|
||||||
LabelList::iterator it = find(m_labelbuttons.begin(),
|
LabelList::iterator it = find(m_labelbuttons.begin(),
|
||||||
m_labelbuttons.end(),
|
m_labelbuttons.end(),
|
||||||
&btn);
|
&btn);
|
||||||
|
@ -303,7 +303,7 @@ void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) {
|
||||||
|
|
||||||
LabelList::iterator new_pos = it;
|
LabelList::iterator new_pos = it;
|
||||||
new_pos--;
|
new_pos--;
|
||||||
FbTk::Button *item = *it;
|
TextButton *item = *it;
|
||||||
// remove from list
|
// remove from list
|
||||||
m_labelbuttons.erase(it);
|
m_labelbuttons.erase(it);
|
||||||
// insert on the new place
|
// insert on the new place
|
||||||
|
@ -312,7 +312,7 @@ void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) {
|
||||||
redrawTitle();
|
redrawTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) {
|
void FbWinFrame::moveLabelButtonRight(const TextButton &btn) {
|
||||||
LabelList::iterator it = find(m_labelbuttons.begin(),
|
LabelList::iterator it = find(m_labelbuttons.begin(),
|
||||||
m_labelbuttons.end(),
|
m_labelbuttons.end(),
|
||||||
&btn);
|
&btn);
|
||||||
|
@ -320,7 +320,7 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) {
|
||||||
if (it == m_labelbuttons.end() || *it == m_labelbuttons.back())
|
if (it == m_labelbuttons.end() || *it == m_labelbuttons.back())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FbTk::Button *item = *it;
|
TextButton *item = *it;
|
||||||
// remove from list
|
// remove from list
|
||||||
LabelList::iterator new_pos = m_labelbuttons.erase(it);
|
LabelList::iterator new_pos = m_labelbuttons.erase(it);
|
||||||
new_pos++;
|
new_pos++;
|
||||||
|
@ -330,15 +330,23 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) {
|
||||||
redrawTitle();
|
redrawTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::setLabelButtonFocus(FbTk::Button &btn) {
|
void FbWinFrame::setLabelButtonFocus(TextButton &btn) {
|
||||||
LabelList::iterator it = find(m_labelbuttons.begin(),
|
LabelList::iterator it = find(m_labelbuttons.begin(),
|
||||||
m_labelbuttons.end(),
|
m_labelbuttons.end(),
|
||||||
&btn);
|
&btn);
|
||||||
if (it == m_labelbuttons.end())
|
if (it == m_labelbuttons.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
// render label buttons
|
||||||
|
|
||||||
|
|
||||||
|
if (m_current_label != 0)
|
||||||
|
renderButtonUnfocus(*m_current_label);
|
||||||
|
|
||||||
m_current_label = *it; // current focused button
|
m_current_label = *it; // current focused button
|
||||||
renderLabelButtons();
|
|
||||||
|
renderButtonFocus(*m_current_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
|
void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
|
||||||
|
@ -986,16 +994,11 @@ void FbWinFrame::renderLabelButtons() {
|
||||||
LabelList::iterator btn_it = m_labelbuttons.begin();
|
LabelList::iterator btn_it = m_labelbuttons.begin();
|
||||||
LabelList::iterator btn_it_end = m_labelbuttons.end();
|
LabelList::iterator btn_it_end = m_labelbuttons.end();
|
||||||
for (; btn_it != btn_it_end; ++btn_it) {
|
for (; btn_it != btn_it_end; ++btn_it) {
|
||||||
|
if (*btn_it == m_current_label)
|
||||||
(*btn_it)->setGC(theme().labelTextFocusGC());
|
renderButtonFocus(**btn_it);
|
||||||
(*btn_it)->setBorderWidth(1);
|
|
||||||
(*btn_it)->setAlpha(theme().alpha());
|
|
||||||
|
|
||||||
if (m_label_unfocused_pm != 0)
|
|
||||||
(*btn_it)->setBackgroundPixmap(m_label_unfocused_pm);
|
|
||||||
else
|
else
|
||||||
(*btn_it)->setBackgroundColor(m_label_unfocused_color);
|
renderButtonUnfocus(**btn_it);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_current_label != 0) {
|
if (m_current_label != 0) {
|
||||||
|
@ -1028,3 +1031,31 @@ void FbWinFrame::setBorderWidth(unsigned int borderW) {
|
||||||
resize(width(), height() + bw_changes);
|
resize(width(), height() + bw_changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FbWinFrame::renderButtonFocus(TextButton &button) {
|
||||||
|
|
||||||
|
button.setGC(theme().labelTextFocusGC());
|
||||||
|
button.setJustify(theme().justify());
|
||||||
|
button.setBorderWidth(1);
|
||||||
|
button.setAlpha(theme().alpha());
|
||||||
|
|
||||||
|
if (m_label_focused_pm != 0)
|
||||||
|
button.setBackgroundPixmap(m_label_focused_pm);
|
||||||
|
else
|
||||||
|
button.setBackgroundColor(m_label_focused_color);
|
||||||
|
|
||||||
|
button.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FbWinFrame::renderButtonUnfocus(TextButton &button) {
|
||||||
|
button.setGC(theme().labelTextUnfocusGC());
|
||||||
|
button.setJustify(theme().justify());
|
||||||
|
button.setBorderWidth(1);
|
||||||
|
button.setAlpha(theme().alpha());
|
||||||
|
|
||||||
|
if (m_label_unfocused_pm != 0)
|
||||||
|
button.setBackgroundPixmap(m_label_unfocused_pm);
|
||||||
|
else
|
||||||
|
button.setBackgroundColor(m_label_unfocused_color);
|
||||||
|
|
||||||
|
button.clear();
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbWinFrame.hh,v 1.11 2003/07/28 12:11:57 fluxgen Exp $
|
// $Id: FbWinFrame.hh,v 1.12 2003/08/13 16:36:37 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef FBWINFRAME_HH
|
#ifndef FBWINFRAME_HH
|
||||||
#define FBWINFRAME_HH
|
#define FBWINFRAME_HH
|
||||||
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
class Shape;
|
class Shape;
|
||||||
class FbWinFrameTheme;
|
class FbWinFrameTheme;
|
||||||
|
class TextButton;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
class ImageControl;
|
class ImageControl;
|
||||||
class Command;
|
class Command;
|
||||||
|
@ -91,15 +93,15 @@ public:
|
||||||
/// remove all buttons from titlebar
|
/// remove all buttons from titlebar
|
||||||
void removeAllButtons();
|
void removeAllButtons();
|
||||||
/// adds a button to label window
|
/// adds a button to label window
|
||||||
void addLabelButton(FbTk::Button &btn);
|
void addLabelButton(TextButton &btn);
|
||||||
/// removes a specific button from label window
|
/// removes a specific button from label window
|
||||||
void removeLabelButton(FbTk::Button &btn);
|
void removeLabelButton(TextButton &btn);
|
||||||
/// move label button to the left
|
/// move label button to the left
|
||||||
void moveLabelButtonLeft(const FbTk::Button &btn);
|
void moveLabelButtonLeft(const TextButton &btn);
|
||||||
/// move label button to the right
|
/// move label button to the right
|
||||||
void moveLabelButtonRight(const FbTk::Button &btn);
|
void moveLabelButtonRight(const TextButton &btn);
|
||||||
/// which button is to be rendered focused
|
/// which button is to be rendered focused
|
||||||
void setLabelButtonFocus(FbTk::Button &btn);
|
void setLabelButtonFocus(TextButton &btn);
|
||||||
/// attach a client window for client area
|
/// attach a client window for client area
|
||||||
void setClientWindow(Window win);
|
void setClientWindow(Window win);
|
||||||
/// same as above but with FbWindow
|
/// same as above but with FbWindow
|
||||||
|
@ -180,6 +182,8 @@ private:
|
||||||
void renderTitlebar();
|
void renderTitlebar();
|
||||||
void renderHandles();
|
void renderHandles();
|
||||||
void renderButtons();
|
void renderButtons();
|
||||||
|
void renderButtonFocus(TextButton &button);
|
||||||
|
void renderButtonUnfocus(TextButton &button);
|
||||||
void renderLabel();
|
void renderLabel();
|
||||||
/// renders to pixmap or sets color
|
/// renders to pixmap or sets color
|
||||||
void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
|
void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
|
||||||
|
@ -213,9 +217,9 @@ private:
|
||||||
typedef std::vector<FbTk::Button *> ButtonList;
|
typedef std::vector<FbTk::Button *> ButtonList;
|
||||||
ButtonList m_buttons_left, ///< buttons to the left
|
ButtonList m_buttons_left, ///< buttons to the left
|
||||||
m_buttons_right; ///< buttons to the right
|
m_buttons_right; ///< buttons to the right
|
||||||
typedef std::list<FbTk::Button *> LabelList;
|
typedef std::list<TextButton *> LabelList;
|
||||||
LabelList m_labelbuttons; ///< holds label buttons inside label window
|
LabelList m_labelbuttons; ///< holds label buttons inside label window
|
||||||
FbTk::Button *m_current_label; ///< which client button is focused at the moment
|
TextButton *m_current_label; ///< which client button is focused at the moment
|
||||||
std::string m_titletext; ///< text to be displayed int m_label
|
std::string m_titletext; ///< text to be displayed int m_label
|
||||||
int m_bevel; ///< bevel between titlebar items and titlebar
|
int m_bevel; ///< bevel between titlebar items and titlebar
|
||||||
bool m_use_titlebar; ///< if we should use titlebar
|
bool m_use_titlebar; ///< if we should use titlebar
|
||||||
|
|
Loading…
Reference in a new issue