fixed timer to update transparent while moving
fluxgen fluxgen
2 files changed,
54 insertions(+),
33 deletions(-)
M
src/FbWinFrame.cc
→
src/FbWinFrame.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.43 2003/08/25 16:17:18 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.44 2003/09/10 09:53:21 fluxgen Exp $ #include "FbWinFrame.hh"@@ -28,6 +28,7 @@ #include "FbTk/EventManager.hh"
#include "FbTk/TextButton.hh" #include "FbTk/App.hh" #include "FbTk/Compose.hh" +#include "FbTk/SimpleCommand.hh" #include "FbWinFrameTheme.hh" #ifdef SHAPE@@ -169,26 +170,12 @@ // update transparent only if we need to
if (theme().alpha() == 255) return; - redrawTitlebar(); + // restart update timer + m_update_timer.start(); - ButtonList::iterator btn_it = m_buttons_left.begin(); - ButtonList::iterator btn_it_end = m_buttons_left.begin(); - for (; btn_it != btn_it_end; ++btn_it) { - (*btn_it)->clear(); - (*btn_it)->updateTransparent(); - } - btn_it = m_buttons_right.begin(); - btn_it_end = m_buttons_right.end(); - for (; btn_it != btn_it_end; ++btn_it) { - (*btn_it)->clear(); - (*btn_it)->updateTransparent(); - } - m_grip_left.clear(); - m_grip_right.clear(); - m_handle.clear(); - m_grip_left.updateTransparent(); - m_grip_right.updateTransparent(); - m_handle.updateTransparent(); + /* + + */ } void FbWinFrame::resize(unsigned int width, unsigned int height) {@@ -219,7 +206,8 @@ }
void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) { move(x, y); - resize(width, height); + if (width != FbWinFrame::width() || height != FbWinFrame::height()) + resize(width, height); } void FbWinFrame::setTitle(const std::string &titletext) {@@ -699,7 +687,8 @@ label().height() + border_width);
(*btn_it)->clear(); (*btn_it)->updateTransparent(); } - + m_titlebar.clear(); + m_label.clear(); } void FbWinFrame::redrawTitlebar() {@@ -894,6 +883,12 @@
} void FbWinFrame::init() { + // setup update timer + FbTk::RefCount<FbTk::Command> update_transp(new FbTk::SimpleCommand<FbWinFrame>(*this, + &FbWinFrame::updateTransparent)); + m_update_timer.setCommand(update_transp); + m_update_timer.setTimeout(10L); + m_update_timer.fireOnce(true); m_disable_shape = false;@@ -979,13 +974,13 @@ else
title_color = m_title_focused_color; } else { - getUnFocusPixmap(label_pm, title_pm, + getUnfocusPixmap(label_pm, title_pm, label_color, title_color); } } -void FbWinFrame::getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, +void FbWinFrame::getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, FbTk::Color &label_color, FbTk::Color &title_color) { if (m_label_unfocused_pm != 0) {@@ -1086,4 +1081,24 @@
button.clear(); } +void FbWinFrame::updateTransparent() { + redrawTitlebar(); + ButtonList::iterator button_it = m_buttons_left.begin(); + ButtonList::iterator button_it_end = m_buttons_left.begin(); + for (; button_it != button_it_end; ++button_it) { + (*button_it)->clear(); + (*button_it)->updateTransparent(); + } + + button_it = m_buttons_right.begin(); + button_it_end = m_buttons_right.end(); + for (; button_it != button_it_end; ++button_it) { + (*button_it)->clear(); + (*button_it)->updateTransparent(); + } + + m_grip_left.updateTransparent(); + m_grip_right.updateTransparent(); + m_handle.updateTransparent(); +}
M
src/FbWinFrame.hh
→
src/FbWinFrame.hh
@@ -19,17 +19,18 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.hh,v 1.14 2003/08/24 15:18:09 fluxgen Exp $ +// $Id: FbWinFrame.hh,v 1.15 2003/09/10 09:53:21 fluxgen Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH -#include "FbWindow.hh" -#include "EventHandler.hh" -#include "RefCount.hh" -#include "Observer.hh" -#include "Color.hh" -#include "FbPixmap.hh" +#include "FbTk/FbWindow.hh" +#include "FbTk/EventHandler.hh" +#include "FbTk/RefCount.hh" +#include "FbTk/Observer.hh" +#include "FbTk/Color.hh" +#include "FbTk/FbPixmap.hh" +#include "FbTk/Timer.hh" #include <vector> #include <list>@@ -112,7 +113,7 @@ /// redirect events to another eventhandler
void setEventHandler(FbTk::EventHandler &evh); /// remove any handler for the windows void removeEventHandler(); - + void hideTitlebar(); void showTitlebar(); void hideHandle();@@ -135,6 +136,9 @@ //@}
void reconfigure(); void setUseShape(bool value); + + void setUpdateDelayTime(long t) { m_update_timer.setTimeout(t); } + /** @name accessors */@@ -188,7 +192,7 @@ void renderLabel();
/// renders to pixmap or sets color void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, unsigned int width, unsigned int height); - void getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, + void getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, FbTk::Color &label_color, FbTk::Color &title_color); void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, FbTk::Color &label_color, FbTk::Color &title_color);@@ -199,6 +203,7 @@ /// initiate some commont variables
void init(); /// initiate inserted buttons for current theme void setupButton(FbTk::Button &btn); + void updateTransparent(); FbWinFrameTheme &m_theme; ///< theme to be used FbTk::ImageControl &m_imagectrl; ///< Image control for rendering@@ -282,6 +287,7 @@ };
ThemeListener m_themelistener; std::auto_ptr<Shape> m_shape; bool m_disable_shape; + FbTk::Timer m_update_timer; }; #endif // FBWINFRAME_HH