aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-05 16:14:06 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-05 16:14:06 +0000
commit7ed2e4a5bf0d8449249871789eb5ee475e0d4e61 (patch)
tree1ed8cd839f2d9ceeaf872a45fbfe8c22e8bb0a73
parentf341d924ad309f0a0342279b5169b74390348acc (diff)
downloadpaludis-7ed2e4a5bf0d8449249871789eb5ee475e0d4e61.tar.gz
paludis-7ed2e4a5bf0d8449249871789eb5ee475e0d4e61.tar.xz
Improve CellRendererButton somewhat more
-rw-r--r--src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc32
-rw-r--r--src/gtkpaludis/tasks_page.cc3
2 files changed, 13 insertions, 22 deletions
diff --git a/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc b/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
index 3fc5268..cf01443 100644
--- a/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
+++ b/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
@@ -38,14 +38,16 @@ void
CellRendererButton::get_size_vfunc(Gtk::Widget & widget, const Gdk::Rectangle * cell_area,
int * x_offset, int * y_offset, int * width, int * height) const
{
-#if 0
- const unsigned int x_pad = property_xpad();
- const unsigned int y_pad = property_ypad();
- const unsigned int x_align = property_xalign();
- const unsigned int y_align = property_yalign();
+ Gtk::CellRendererText::get_size_vfunc(widget, cell_area, x_offset, y_offset,
+ width, height);
- const int calculated_width = 2 * x_pad + _button_width;
- const int calculated_height = 2 * y_pad + _button_height;
+ const unsigned int x_pad = 4;
+ const unsigned int y_pad = 4;
+ const float x_align = property_xalign();
+ const float y_align = property_yalign();
+
+ const int calculated_width = 2 * x_pad + (width ? *width : 0);
+ const int calculated_height = 2 * y_pad + (height ? *height : 0);
if (width)
*width = calculated_width;
@@ -55,22 +57,10 @@ CellRendererButton::get_size_vfunc(Gtk::Widget & widget, const Gdk::Rectangle *
if (cell_area)
{
if (x_offset)
- *x_offset = std::max<int>(0, x_align * (cell_area->get_width() - calculated_width));
+ *x_offset = std::max(0, static_cast<int>(x_align * (cell_area->get_width() - calculated_width)));
if (y_offset)
- *y_offset = std::max<int>(0, y_align * (cell_area->get_height() - calculated_height));
+ *y_offset = std::max(0, static_cast<int>(y_align * (cell_area->get_height() - calculated_height)));
}
-#else
- Gtk::CellRendererText::get_size_vfunc(widget, cell_area, x_offset, y_offset,
- width, height);
- if (width)
- *width += 10;
- if (height)
- *height += 6;
- if (x_offset)
- *x_offset = 0;
- if (y_offset)
- *y_offset = 0;
-#endif
}
void
diff --git a/src/gtkpaludis/tasks_page.cc b/src/gtkpaludis/tasks_page.cc
index cdcdb68..737910f 100644
--- a/src/gtkpaludis/tasks_page.cc
+++ b/src/gtkpaludis/tasks_page.cc
@@ -68,7 +68,8 @@ namespace
#endif
{
- append_column("Icon", columns.col_icon);
+ get_column(append_column("Icon", columns.col_icon) - 1)->get_first_cell_renderer()->
+ set_fixed_size(40, 40);
get_column(append_column("Text", columns.col_text) - 1)->set_expand(true);
CellRendererButton * const renderer = new CellRendererButton;