Problem restoring pane handle position after fullscreen
- From: "Tim Mayberry" <mojofunk gmail com>
- To: gtkmm-list gnome org
- Subject: Problem restoring pane handle position after fullscreen
- Date: Wed, 7 Jun 2006 15:51:31 +1000
Hello,
I don't think i've posted to this list before so I'll start by
thanking everyone involved with gtkmm, it is a real pleasure to use so
far.
I noticed what appeared to be a bug in an application that I use a
fair bit and it annoyed me enough that I set out to fix it. I couldn't
see anything obviously wrong with the code so I created a silly test
case that exhibits the same behaviour.
The application(and the test case) contains a horizontal pane, when
the window is in fullscreen mode child1 of the pane is set to occupy
the entire space, then when the window is restored using unfullscreen
the pane handle is reset to the position it was in before the
fullscreen. I can't get the position of the pane handle to restore to
the correct location and I'd appreciate it if someone could tell me
what is preventing it from working, is the code incorrect or is there
some other problem.
Thanks in advance, test case follows:
#include <gtkmm.h>
class PaneTest : public Gtk::Window
{
public:
PaneTest();
protected:
void on_pane_toggled();
Gtk::VBox m_box;
Gtk::Button m_child1_button;
Gtk::Button m_child2_button;
Gtk::HPaned m_pane;
Gtk::ToggleButton m_toggle_button;
gint m_last_pane_position;
};
PaneTest::PaneTest()
: m_toggle_button("Maximize Child Button 1"),
m_child1_button("Pane Child Button 1"),
m_child2_button("Pane Child Button 2"),
m_last_pane_position(0)
{
set_title("pane test");
set_border_width(10);
m_toggle_button.signal_toggled().connect( sigc::mem_fun(*this,
&PaneTest::on_pane_toggled) );
m_pane.pack1(m_child1_button, true, true);
m_pane.pack2(m_child2_button, true, true);
m_box.pack_start(m_pane);
m_box.pack_start(m_toggle_button);
add(m_box);
show_all_children();
}
void
PaneTest::on_pane_toggled()
{
if(m_toggle_button.get_active()) {
m_last_pane_position = m_pane.get_position();
m_pane.set_position(m_pane.property_max_position());
fullscreen();
} else {
unfullscreen();
m_pane.set_position(m_last_pane_position);
}
}
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
PaneTest ptest;
Gtk::Main::run(ptest);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]