Patch from issue 975 on behalf of Phil: "Proposition of a patch right Pannel (new visual rendering <-> icons instead of text)"

It moreover better handle workflow changes: no need to restart RT for some options.
This commit is contained in:
natureh
2011-09-18 15:39:21 +02:00
parent d37af496b4
commit 08b967f62b
27 changed files with 345 additions and 59 deletions

View File

@@ -351,3 +351,48 @@ bool MyFileChooserButton::on_scroll_event (GdkEventScroll* event) {
// ... otherwise the scroll event is sent back to an upper level
return false;
}
TextOrIcon::TextOrIcon (Glib::ustring fname, Glib::ustring labelTx, Glib::ustring tooltipTx, TOITypes type) {
imgIcon = 0;
label = 0;
filename = fname;
labelText = labelTx;
tooltipText = tooltipTx;
switchTo(type);
}
TextOrIcon::~TextOrIcon () {
if (imgIcon) delete imgIcon;
if (label) delete label;
}
void TextOrIcon::switchTo(TOITypes type) {
switch (type) {
case (TOI_ICON):
if (!imgIcon) {
removeIfThere(this, label, false);
delete label;
label = 0;
imgIcon = new Gtk::Image (filename);
pack_start(*imgIcon, Gtk::PACK_SHRINK, 0);
set_tooltip_markup ("<span font_size=\"large\" font_weight=\"bold\">" + labelText + "</span>\n" + tooltipText);
}
// do nothing if imgIcon exist, which mean that it is currently being displayed
break;
case(TOI_TEXT):
default:
if (!label) {
removeIfThere(this, imgIcon, false);
delete imgIcon;
imgIcon = 0;
label = new Gtk::Label (labelText, Gtk::ALIGN_CENTER);
pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0);
set_tooltip_markup (tooltipText);
}
// do nothing if label exist, which mean that it is currently being displayed
break;
}
show_all();
}