File: main.cc

package info (click to toggle)
gtkmm2.4 1%3A2.24.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 149,096 kB
  • ctags: 20,365
  • sloc: xml: 80,438; cpp: 6,880; sh: 4,126; perl: 236; makefile: 228
file content (60 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <gtkmm.h>
#include <gtk/gtk.h>
#include <iostream>
#include <list>


class MyDialog : public Gtk::Dialog {
public:
  MyDialog()
   {
     add_button("Ok", 0);
   }
};

class MyWindow : public Gtk::Window
{
public:
  MyWindow();

  void on_button_clicked();

protected:
  Gtk::HBox m_Box;
  Gtk::Button m_Button;
};

MyWindow::MyWindow()
: m_Button("Show Dialog")
{
  set_size_request(200, 200);

  m_Button.signal_clicked().connect( sigc::mem_fun(*this, &MyWindow::on_button_clicked) );
  m_Box.pack_start(m_Button);
  add(m_Box);
}

void MyWindow::on_button_clicked()
{
  {
    MyDialog d;
    d.run();
    std::cout << "After d.run()" << std::endl;
  }

   std::cout << "before list_toplevel" << std::endl;
  std::list<Gtk::Window*> toplevelwindows = list_toplevels();
   std::cout << "after list_toplevel" << std::endl;

  std::cout << "toplevelwindows.size = " << toplevelwindows.size() << std::endl;
}

int main(int argc, char* argv[])
{
  Gtk::Main kit(argc, argv);

  MyWindow win;
  win.show_all();
  kit.run(win);
  return 0;
}