Lumiera  0.pre.03
»edit your freedom«
flash-deco.hpp
Go to the documentation of this file.
1 /*
2  FLASH-DECO.hpp - widget decorator to add a visual flash action
3 
4  Copyright (C)
5  2018, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
31 #ifndef STAGE_MODEL_FLASH_DECO_H
32 #define STAGE_MODEL_FLASH_DECO_H
33 
34 
35 #include "stage/gtk-base.hpp"
36 #include "stage/style-scheme.hpp"
37 
38 
39 namespace stage {
40 namespace model {
41 
42 
49  template<class WIT>
50  class FlashDeco
51  : public WIT
52  {
53  static_assert (std::is_base_of<Gtk::Widget, WIT>()
54  ,"wrapped target type required to be a Gtk::Widget");
55  public:
56  using WIT::WIT;
57 
58  void
59  flash()
60  {
61  auto styleContext = this->get_style_context();
62  styleContext->add_class (CLASS_indication_flash);
63 
64  Glib::signal_timeout()
65  .connect_once (sigc::mem_fun(*this, &FlashDeco::flashback)
66  ,STYLE_FLASH_DURATION_in_ms
67  ,Glib::PRIORITY_LOW); // after all pending drawing tasks
68  }
69 
70  private:
71  void
72  flashback()
73  {
74  auto styleContext = this->get_style_context();
75  styleContext->remove_class (CLASS_indication_flash);
76  }
77  };
78 
79 
80 }} // namespace stage::model
81 #endif /*STAGE_MODEL_FLASH_DECO_H*/
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
cuString CLASS_indication_flash
CSS class added temporarily to make a widget "flash" in response to the corresponding UI-Bus message...
Definition of access keys for uniform UI styling.
A set of basic GTK includes for the UI.
Decorator for a Gtk::Widget to add a visual flash action.
Definition: flash-deco.hpp:50