infinite scroll - gtkmm Gtk::Layout negative child position not setting its absolute position -
the description of gtk::layout
says
infinite scrollable area containing child widgets and/or custom drawing
i put gtk::layout
inside gtk::scrolledwindow
, gave gtk::layout
size of 400x400 , placed gtk::button
@ (450, 450), scrollbars appeared until scrolled window resized 400x400, not (450+button-width x 450+button-height). had move bottom-right corner of layout connecting handler button's signal_size_allocate()
signal , manually call gtk::layout::set_size()
function resize button's boundary. scrolled window shows scrollbars reach button. ok.
class layoutwindowtest : public applicationwindow { scrolledwindow sw; layout l; button b; public: layoutwindowtest() : l(), b("test") { set_title("layout test"); set_size_request(400, 400); sw.set_hadjustment(l.get_hadjustment()); sw.set_vadjustment(l.get_vadjustment()); l.set_size(400, 400); sw.add(l); add(sw); // b.get_allocation() won't work because button has not been allocated // size yet b.signal_size_allocate().connect( [this](allocation& btn_sz) { l.set_size(btn_sz.get_x() + btn_sz.get_width(), btn_sz.get_y() + btn_sz.get_height()); }); l.put(b, 450, 450); show_all_children(); } virtual ~layoutwindowtest() {} };
initial window showing scrollbars , scrolled bottom-right corner show button
now need same thing top-left corner, i.e. put button out of visible boundary of scrolled window , use scrollbars reach button. tried putting button @ (-10, -10), unlike previous case can't set layout's top-left corner code resizing it, can't move layout's scrollbars. when resize scrolled window manually top-left corner button moves towards top-left instead of staying there. how remedy situation?
initial window button @ (-10, -10) , no scrollbars, tried resizing window top-left handle button moves it
in short, how can scroll in both top-left , bottom-right directions infinitely?
Comments
Post a Comment