Exemplo n.º 1
1
int main(int argc, char** argv) {
	Gtk::Main kit(argc, argv);
	MiArea ma;
	Gtk::Window v;
	v.add(ma);
	v.show_all();
	Gtk::Main::run(v);
	return 0;	
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
	gdk_threads_init();
	gdk_threads_enter();

	gSimuApp = Gtk::Application::create(argc, argv, "org.gtkmm.example");

	Gtk::Window win;
	win.set_title("RE8000 Simulador");
	win.set_default_size(800, 480);

	/* Virtual Framebuffer area */
	pArea = new MyArea;

	/* Input */
	pArea->add_events(Gdk::BUTTON_PRESS_MASK);
	pArea->signal_button_press_event().connect(sigc::ptr_fun(&VirtualInputClickHandler));
	pArea->add_events(Gdk::BUTTON_RELEASE_MASK);
	pArea->signal_button_release_event().connect(sigc::ptr_fun(&VirtualInputClickHandler));
	gdk_threads_leave();

	/* Fb */
	pVirtFb = new char[800 * 480 * 2];

	/* Gtk Window call */
	win.add(*pArea);
	pArea->show();


	pMarsh = new marshmallow_thread;

	return gSimuApp->run(win);
}
Exemplo n.º 3
0
int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);	
	Dibujo d;
	Gtk::Window v;
	v.add(d);
	v.show_all();
	Gtk::Main::run(v);
	return 0;
}	
Exemplo n.º 4
0
int main(int argc, char** argv) {
	auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
	Gtk::Window win;
	win.set_title("Cairo example");
	MyArea my_area;
	win.add(my_area);
	my_area.show();
	return app->run(win);
}
Exemplo n.º 5
0
int main(int argc, char* argv[]) {
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
    Gtk::Window win;
	win.set_title("DrawingArea");
	Ovalo area;
	win.add(area);
	area.show();
    return app->run(win);
}
Exemplo n.º 6
0
int main(int argc, char *argv[])
{
  Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv);

  Gtk::Window window;
  Gtk::Button button("Hello World");
  button.signal_clicked().connect(sigc::mem_fun(window, &Gtk::Window::close));
  window.add(button);
  window.show_all();

  return app->run(window);
}
Exemplo n.º 7
0
void TestExampleDA(DAExposeFunc ef)
{
    InitGtkmm();

    ExampleDA da(ef);

    Gtk::Window win;
    win.set_default_size(400, 400);
    win.add(da);

    RunWindow(win);
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{

    // make window
    Glib::RefPtr<Gtk::Application> app =
        Gtk::Application::create(argc, argv,
                                 "tutorial2");

    Gtk::Window window;

    window.set_default_size(400,200);
    window.set_title("Tutorial 2");

    // This creates a vertical box container with 0 padding
    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    window.add(*vbox);

    // creates menu bar
    Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
    vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

    // create menu items
    Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
    menubar->append(*menuitem_file);
    Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
    menuitem_file->set_submenu(*filemenu);
    Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
    filemenu->append(*menuitem_quit);

    // create grid container with border width 10
    // and add it to the new cell of the vertical box
    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_border_width(10);
    vbox->add(*grid);

    // create button
    Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Button 1"));
    b1->set_hexpand(true);		//  take up all unused space horizontally
    b1->set_vexpand(true);		//  take up all unused space vertically
    // possition 0(x), 0(y), span 1 cell wide and 2 cells down
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();

    return app->run(window);
}
Exemplo n.º 9
0
int main(int argc, char *argv[]) {
    Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
    Gtk::Window window;
    window.set_border_width(40);
    Gtk::Button close("Close");

    window.add(close);
    close.signal_clicked().connect(sigc::mem_fun(window, &Gtk::Window::unset_application));
    
    window.show_all();
    app->run(window);
    return 0;
}
Exemplo n.º 10
0
int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);
	Gtk::Entry entry;
	BotonPasarAMayusculas boton(&entry);
	Gtk::VBox vbox;
	vbox.add(entry);
	vbox.add(boton);
	Gtk::Window v;
	v.add(vbox);
	v.show_all();
	Gtk::Main::run(v);
	return 0;
}	
Exemplo n.º 11
0
int main(int argc, char* argv[]) {
  Gtk::Main kit(argc, argv);
  Gtk::Window window;
  string path;
  char c;

  while ((c = getopt(argc, argv, "h")) != -1) {
    switch (c) {
    case 'h':
    default:
      print_usage(argv[0]);
    }
  }

  if (optind < argc-1)
    print_usage(argv[0]);

  if (optind < argc)
    path = argv[optind];
  else {
    FileChooserDialog dialog("Choose an audio sample to load", FILE_CHOOSER_ACTION_OPEN);
    dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    dialog.add_button("Select", RESPONSE_OK);
    if (dialog.run() != RESPONSE_OK)
      return 1;
    dialog.hide();
    path = dialog.get_filename();
  }

  unique_ptr<grain_widget> grain;
  atomic<bool> grain_loaded(false);
  thread t([&]() {
      grain = unique_ptr<grain_widget>(new grain_widget(path));
      grain_loaded.store(true);
    });
  t.detach();
  Dialog progress;
  ProgressBar bar;
  //progress.set_default_size(640,100);
  progress.set_resizable(false);
  progress.get_vbox()->pack_end(bar, PACK_SHRINK);
  progress.show_all();
  Glib::signal_timeout().connect(sigc::bind(sigc::ptr_fun(msg_callback), &progress, &bar, &grain_loaded), 100);
  progress.run();
  //printf("foo bar\n");
  // msg.hide();
  window.add(*grain);
  grain->show();
  Gtk::Main::run(window);
  return 0;
}
Exemplo n.º 12
0
int main(int argc, char **argv){

    Gtk::Main     kit (argc, argv);
    Gtk::Window   win;
    GObjTestTile  pl;

    SimpleViewer viewer(&pl);

    win.add(viewer);
    win.set_default_size(640,480);
    win.show_all();

    kit.run(win);
}
Exemplo n.º 13
0
int main( int argc, const char* argv[] )
{
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");

	Gtk::Window win;
	win.set_title("tut_2d_physics_engine");

	Main_engine * engi = new Main_engine();//Don't think this is ever deleted

	win.add(*sim);
	engi->show();
	
	return app->run(win);
}
Exemplo n.º 14
0
int main(int argc, char **argv){

    Gtk::Main     kit (argc, argv);
    Gtk::Window   win;
    GObjTestGrid  pl(150000);

    DThreadViewer viewer(&pl);

    win.add(viewer);
    win.set_default_size(640,480);
    win.show_all();

    kit.run(win);
}
Exemplo n.º 15
0
void
DoScaledText()
{
    InitGtkmm();

    Gtk::Window win;
    ScaledText t_wdg;

    win.set_title("Scaled Text");
    win.set_border_width(0);

    win.set_default_size(300, 100);
    win.add(t_wdg);
    RunWindow(win);
}
Exemplo n.º 16
0
int main(int argc, char *argv[]){
    //Inicializamos el framework
    Gtk::Main kit(argc, argv);

    Gtk::CheckButton button("Checkbox button");

    Gtk::Window window;
    window.set_default_size(400,400);
    window.add(button);
    window.show_all();

    //Iniciamos el loop de eventos
    Gtk::Main::run(window);
    return 0;
}
Exemplo n.º 17
0
int main(int argc, char *argv[] )
{
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");

	Gtk::Window win;
	win.set_title("CGOL - SFC");

	Simple_GOL_Area * area = new Simple_GOL_Area(50,50);

	win.add(*area);
	area->show();
	
	return app->run(win);
	//return 0;
}
Exemplo n.º 18
0
int main(int argc, char* argv[])
{
   Gtk::Main kit(argc, argv);  //this must be first
   ListArray<CD>* cds = CD::readCDs("cds.txt");
   //DO THIS
   //create the sorted linked list (call it sorted_list)
	   SortedListLinked<CD>* sorted_list = new SortedListLinked<CD>(&CD::compare_items);



   String title("CDs");
   ListBox<CD>* lstCDs = new ListBox<CD>(&title, sorted_list);
   addCDs(cds, lstCDs);

   Gtk::Window win;

   win.set_title("Music!");
   win.set_position(Gtk::WIN_POS_CENTER);

   //the size of the window
   int width = 640;
   int height = 520;

   win.set_size_request(width, height);
   win.set_resizable(false);  

   //10 rows, 1 column
   Gtk::Table tbl(10, 1, true);

   Gtk::Button btnRemove("Remove");

   //left attach, right attach, top attach, bottom attach
   tbl.attach(*lstCDs, 0, 1, 0, 9, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 0, 0);
   tbl.attach(btnRemove, 0, 1, 9, 10, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 0, 0);
   win.add(tbl);

   //a button must register with a method that has a void return type
   btnRemove.signal_clicked().connect(sigc::mem_fun(lstCDs, &ListBox<CD>::removeSelectedItem));

   win.show_all_children();
   Gtk::Main::run(win);

   deleteCDs(cds);
   delete cds;
   delete lstCDs;

   return 0;
}
Exemplo n.º 19
0
int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);
	Gtk::ComboBoxText combo;
	combo.append_text("asdfhbb");
	combo.append_text("45ggdfdfs");
	combo.append_text("avbbhrr");
	combo.append_text("khjgh2");
	combo.append_text("cxzeee");
	combo.append_text("quieroaprobartaller");
	BotonOrdenar boton(&combo);
	Gtk::VBox vbox;
	vbox.add(combo);
	vbox.add(boton);
	Gtk::Window v;
	v.add(vbox);
	v.show_all();
	Gtk::Main::run(v);
	return 0;
}	
Exemplo n.º 20
0
void
DoTextWidget()
{
    InitGtkmm();

    Gtk::Window win;
    TextWidget t_wdg;

    Gdk::Color white;
    white.set_rgb(0x0, 0x0, 0xffff);

    win.set_title("TextWidget");

    t_wdg.modify_bg(Gtk::STATE_NORMAL, white);

    win.set_default_size(300, 300);
    win.add(t_wdg);

    RunWindow(win);
}
Exemplo n.º 21
0
int main(int argc, char **argv){

    Gtk::Main     kit (argc, argv);
    Gtk::Window   win;
    GObjTestTile  p1;

    SimpleViewer viewer(&p1);
    Rubber rubber(&viewer);

    iPoint p(20,20);
    rubber.add_src_sq(p, 3);
    rubber.add_dst_sq(3);
    rubber.add_rect(p);
    rubber.add_line(p);

    win.add(viewer);
    win.set_default_size(640,480);
    win.show_all();

    kit.run(win);
}
Exemplo n.º 22
0
int main(int argc, char* argv[]) {
  Gtk::Main kit(argc, argv);

  AnalogueGUI guiBox("http://www.westkamper.com/lv2/analogue/gui"); 

  float controls[p_n_ports-3];
  for (int i = 0; i < p_n_ports-3; i++)  {
    controls[i] = p_port_meta[i].default_value;
  }

  Gtk::Window window;
  window.set_title("Analogue");
  window.set_default_size(800, 400);
  window.add(guiBox);
  window.show_all();

  Gtk::Main::run(window);

  return 0;

}
Exemplo n.º 23
0
int main(int argc , char *argv[])
{
	std::cout << "widget test: WaveView dialog" << std::endl;
	Gtk::Main kit (argc,argv);
	Gtk::Window window;
	Gtk::Button button("Quit");
	Gtk::HBox hbox;
	MidiEditor waveview;
	
	// bind button to quit value of kit, by providing pointer to kit.
	button.signal_clicked().connect( sigc::bind(sigc::ptr_fun ( quit ), &kit));
	
	hbox.add(waveview);
	hbox.add(button);
	
	window.add(hbox);
	window.show_all();
	kit.run(window);
	
	return 0;
	
}
Exemplo n.º 24
0
int main(int argc, char** argv)
{
   Matrix* mat = Matrix::readMatrix("maze.txt");

   Gtk::Main kit(argc, argv);

   Gtk::Window win;
   win.set_title("Maze!");
   win.set_position(Gtk::WIN_POS_CENTER);
   //the size of the window
   int width = 875;
   int height = 445;

   win.set_size_request(width, height);
   win.set_resizable(false);  

   Gtk::Table tbl(10, 1, true);
   int rows = tbl.property_n_rows();
   int button_height = (int) (((double) height)/rows + 0.5);

   Maze* maze = new Maze(mat);
   MazeGUI mg(width, height - button_height, maze);  //needs to know its own dimensions
   Gdk::Color c("#FF0000");
   Gtk::Button btnMaze("Solve!");

   btnMaze.signal_clicked().connect(sigc::mem_fun(mg, &MazeGUI::on_maze_button_click_event));

   tbl.attach(mg, 0, 1, 0, 9, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 0, 0);
   tbl.attach(btnMaze, 0, 1, 9, 10, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 0, 0);
   win.add(tbl);

   win.show_all_children();
   Gtk::Main::run(win);

   return 0;
}
Exemplo n.º 25
0
// Main
int main(int argc, char *argv[])
{
    // Init GTK
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    window.set_size_request(450, 350);

        Gtk::Fixed fixed;
        window.add(fixed);

            // Lines ////////

            Lines lines;
            lines.set_size_request(500, 425);

            // FLTK
            lines.add_line(230, 45, 110, 115);
            lines.add_line(270, 45, 270, 90);
            lines.add_line(290, 45, 400, 165);
            lines.add_line(310, 40, 350, 60);

            // Point
            lines.add_line(110, 55, 110, 115);
            lines.add_line(150, 55, 210, 90);

            // Graph
            lines.add_line(110, 160, 90, 240);
            lines.add_line(110, 160, 170, 340);

            // Window
            lines.add_line(250, 135, 230, 190);
            lines.add_line(270, 135, 270, 265);
            lines.add_line(320, 135, 400, 165);

            // GUI
            lines.add_line(340, 210, 270, 265);
            lines.add_line(390, 210, 400, 240);

            // Simple
            lines.add_line(200, 310, 170, 340);

            // So difficult... >.<

            fixed.add(lines);

            // Nodes ////////

            TitledText tt1("Point.h", "struct Point { ... };");
            fixed.put(tt1, 50, 25);

            TitledText tt2("Graph.h", "// graphing interface\nstruct Shape { ... };\n...");
            fixed.put(tt2, 50, 100);

            TitledText tt3("Graph.cpp", "Graph code");
            fixed.put(tt3, 25, 225);

            TitledText tt4("Window.h", "// window interface\nclass Window { ... };\n...");
            fixed.put(tt4, 200, 75);

            TitledText tt5("Window.cpp", "Window code");
            fixed.put(tt5, 150, 175);

            TitledText tt6("GUI.h", "// GUI interface\nstruct In_box { ... };\n...");
            fixed.put(tt6, 325, 150);

            TitledText tt7("GUI.cpp", "GUI code");
            fixed.put(tt7, 350, 225);

            TitledText tt8("Simple_window.h", "// window interface\nclass Simple_window { ... };\n...");
            fixed.put(tt8, 175, 250);

            TitledText tt9("chapter12.cpp", "#include \"Graph.h\"\n#include \"Simple_window.h\"\nint main { ... }");
            fixed.put(tt9, 75, 325);

            FramedText ft1("FLTK headers");
            ShadowFrame<FramedText> sfa1(ft1);
            ShadowFrame<ShadowFrame<FramedText> > sfb1(sfa1, 2);
            fixed.put(sfb1, 225, 25);

            FramedText ft2("FLTK code");
            ShadowFrame<FramedText> sfa2(ft2);
            ShadowFrame<ShadowFrame<FramedText> > sfb2(sfa2, 2);
            fixed.put(sfb2, 350, 50);

    // Done, run the application
    window.show_all_children();
    Gtk::Main::run(window);

    return EXIT_SUCCESS;
}