13
0

extend ArdourWidgets::Frame to allow no-draw of frame

Associated: disambiguate Frame use where necessary.
This commit is contained in:
Paul Davis 2023-01-22 17:34:25 -07:00
parent d982507085
commit 46a8073ff2
3 changed files with 111 additions and 94 deletions

View File

@ -167,10 +167,10 @@ PluginManagerUI::PluginManagerUI ()
_pane.set_divider (0, .85); _pane.set_divider (0, .85);
Label* lbl = manage (new Label ("")); // spacer Label* lbl = manage (new Label ("")); // spacer
Frame* f_info = manage (new Frame (_("Plugin Count"))); Gtk::Frame* f_info = manage (new Gtk::Frame (_("Plugin Count")));
Frame* f_paths = manage (new Frame (_("Preferences"))); Gtk::Frame* f_paths = manage (new Gtk::Frame (_("Preferences")));
Frame* f_search = manage (new Frame (_("Search"))); Gtk::Frame* f_search = manage (new Gtk::Frame (_("Search")));
Frame* f_actions = manage (new Frame (_("Scan Actions"))); Gtk::Frame* f_actions = manage (new Gtk::Frame (_("Scan Actions")));
VBox* b_paths = manage (new VBox ()); VBox* b_paths = manage (new VBox ());
VBox* b_actions = manage (new VBox ()); VBox* b_actions = manage (new VBox ());

View File

@ -42,6 +42,7 @@ Frame::Frame (Orientation orientation, bool boxy)
, _alloc_x0 (0) , _alloc_x0 (0)
, _alloc_y0 (0) , _alloc_y0 (0)
, _boxy (boxy) , _boxy (boxy)
, _draw (true)
{ {
set_name ("Frame"); set_name ("Frame");
ensure_style (); ensure_style ();
@ -213,6 +214,8 @@ Frame::get_parent_style ()
bool bool
Frame::on_expose_event (GdkEventExpose* ev) Frame::on_expose_event (GdkEventExpose* ev)
{ {
if (_draw) {
Glib::RefPtr<Style> pstyle (get_parent_style ()); Glib::RefPtr<Style> pstyle (get_parent_style ());
Glib::RefPtr<Style> style (get_style ()); Glib::RefPtr<Style> style (get_style ());
@ -312,6 +315,7 @@ Frame::on_expose_event (GdkEventExpose* ev)
_layout->show_in_cairo_context (cr); _layout->show_in_cairo_context (cr);
cr->restore (); cr->restore ();
} }
}
if (_w->get_visible ()) { if (_w->get_visible ()) {
propagate_expose (*_w, ev); propagate_expose (*_w, ev);
@ -360,3 +364,12 @@ Frame::set_label (std::string const& t)
_label_text = t; _label_text = t;
queue_resize (); queue_resize ();
} }
void
Frame::set_draw (bool yn)
{
if (_draw != yn) {
_draw = yn;
queue_draw ();
}
}

View File

@ -44,6 +44,9 @@ public:
void set_edge_color (Gtkmm2ext::Color); void set_edge_color (Gtkmm2ext::Color);
void reset_edge_color (); void reset_edge_color ();
void set_draw (bool yn);
bool draw() const { return _draw; }
protected: protected:
void on_add (Gtk::Widget*); void on_add (Gtk::Widget*);
void on_remove (Gtk::Widget*); void on_remove (Gtk::Widget*);
@ -75,6 +78,7 @@ private:
int _alloc_x0; int _alloc_x0;
int _alloc_y0; int _alloc_y0;
bool _boxy; bool _boxy;
bool _draw;
}; };
} // namespace ArdourWidgets } // namespace ArdourWidgets