Commit 74a4dff6 authored by daniel_e's avatar daniel_e
Browse files

New fancy experiment to make labels both selectable _and_ focusable, so

* src/aboutdialog.cc (SelectableLabel): New fancy experiment to make labels
both selectable _and_ focusable, so that they end up in the Tab chain.

* src/aboutdialog.cc src/imagebutton.cc src/prefdialog.cc: Don't show all
children of custom "composite" widgets in the constructor.  It doesn't make
much sense since we call show_all() later on anyway.  And making these
"composite" widgets really independent components would require overriding
both show_all_vfunc() and hide_all_vfunc(), which is currently not worth
the effort.
parent 7de71789
2002-12-30 Daniel Elstner <daniel.elstner@gmx.net>
* src/aboutdialog.cc (SelectableLabel): New fancy experiment to
make labels both selectable _and_ focusable, so that they end up
in the Tab chain.
* src/aboutdialog.cc src/imagebutton.cc src/prefdialog.cc: Don't
show all children of custom "composite" widgets in the constructor.
It doesn't make much sense since we call show_all() later on anyway.
And making these "composite" widgets really independent components
would require overriding both show_all_vfunc() and hide_all_vfunc(),
which is currently not worth the effort.
2002-12-28 Daniel Elstner <daniel.elstner@gmx.net>
* pixmaps/regexxer.png: Replace with a much nicer icon stolen from
......
......@@ -41,6 +41,38 @@ const char regexxer_author_mail[] = "Daniel Elstner <daniel.elstner@gmx.net>";
const char regexxer_debian_mail[] = "Ross Burton <ross@burtonini.com>";
class SelectableLabel : public Gtk::Label
{
public:
SelectableLabel(const Glib::ustring& label);
virtual ~SelectableLabel();
protected:
virtual bool on_focus(Gtk::DirectionType direction);
};
SelectableLabel::SelectableLabel(const Glib::ustring& label)
:
Gtk::Label(label)
{
set_selectable(true);
}
SelectableLabel::~SelectableLabel()
{}
bool SelectableLabel::on_focus(Gtk::DirectionType)
{
if(can_focus() && !is_focus())
{
grab_focus();
return true;
}
return false;
}
class ContributorBox : public Gtk::VBox
{
public:
......@@ -58,11 +90,7 @@ ContributorBox::ContributorBox(const Glib::ustring& what, const Glib::ustring& w
pack_start(*manage(label_what), PACK_SHRINK);
label_what->set_markup("<span size=\"small\">" + what + "</span>");
Label *const label_who = new Label(who);
pack_start(*manage(label_who), PACK_SHRINK);
label_who->set_selectable(true);
show_all_children();
pack_start(*manage(new SelectableLabel(who)), PACK_SHRINK);
}
ContributorBox::~ContributorBox()
......@@ -80,7 +108,7 @@ AboutDialog::AboutDialog(Gtk::Window& parent)
{
using namespace Gtk;
add_button(Stock::OK, RESPONSE_OK);
add_button(Stock::OK, RESPONSE_OK)->grab_focus();
Box& box_dialog = *get_vbox();
Alignment *const alignment = new Alignment(0.5, 0.33, 0.0, 0.0);
......
......@@ -34,9 +34,7 @@ namespace Regexxer
ImageButton::ImageButton(const Gtk::StockID& stock_id, const Glib::ustring& name)
{
Gtk::Image *const image = new Gtk::Image(stock_id, Gtk::ICON_SIZE_BUTTON);
add(*Gtk::manage(image));
image->show();
add(*Gtk::manage(new Gtk::Image(stock_id, Gtk::ICON_SIZE_BUTTON)));
#if REGEXXER_HAVE_GTKMM_22
get_accessible()->set_name(name);
......@@ -62,8 +60,6 @@ ImageLabelButton::ImageLabelButton(const Gtk::StockID& stock_id, const Glib::ust
box->pack_start(*manage(new Image(stock_id, ICON_SIZE_BUTTON)), PACK_SHRINK);
box->pack_start(*manage(new Label(label, mnemonic)), PACK_SHRINK);
alignment->show_all();
}
ImageLabelButton::~ImageLabelButton()
......
......@@ -105,8 +105,6 @@ FontSelectionButton::FontSelectionButton()
box->pack_start(*manage(label_font_ = new Label()), PACK_EXPAND_WIDGET, 5);
box->pack_start(*manage(new VSeparator()), PACK_SHRINK);
box->pack_start(*manage(label_size_ = new Label()), PACK_SHRINK, 5);
box->show_all();
}
FontSelectionButton::~FontSelectionButton()
......@@ -185,7 +183,6 @@ private:
ColorSelectionButton::ColorSelectionButton()
{
add(*Gtk::manage(colorlabel_ = new ColorLabel()));
colorlabel_->show();
}
ColorSelectionButton::~ColorSelectionButton()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment