Re: Placement of popup ( CellRendererDate from examples )




On Sep 5, 2005, at 7:31 PM, Daniel Kasak wrote:

How would I go about modifying this to detect whether the calculated y position puts part of the calendar off-screen?

Simply calculate whether $y_origin + $cell_area->y + $cell_area- >height + $popup->allocation->height is greater than the available screen height. (You imply this below, so i suspect you already knew that.) If it is, then place the popup above the cell instead of below it.


I know ( or I think I know anyway ... I haven't tried it yet ) I can do $popup->allocation to get the size of the popup.

There's also get_size_request(), which will ask the widget to calculate the size it wants (which propagates to children); you can use this before the widget is onscreen to avoid flicker.


But how do I get the screen size?

# since gtk+ 2.2:
$screen = $widget->get_screen;
$width = $screen->get_width;
$height = $screen->get_height;

# for gtk+ 2.0.x, there were Gtk2::Gdk->get_screen_(width|height), but they don't play nicely with multihead stuff.




--
In some newer operating systems, time_t has been widened to 64 bits. In the negative direction, this goes back more than twenty times the age of the universe, and so suffices. In the positive direction, whether this range is sufficient to represent all possible times depends on the ultimate fate of the universe, but it can be expected to postpone overflow long enough for such implementation limits to be abolished.
  -- Wikipedia, on UNIX time.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]