Пример #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;	
}
Пример #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);
}
Пример #3
0
Gtk::Window *Control::init(Glib::RefPtr<Gtk::Builder> builder) {
    Gtk::Window *window;
    Gtk::Paned *pane;

    builder->get_widget("main_window", window);
    builder->get_widget("main_pane", pane);

    init_find_all(builder);
    init_spin_buttons(builder);
    init_scales(builder);
    init_menu(builder);

    pane->add2(_drawArea);

    window->add_events(Gdk::KEY_PRESS_MASK);
    window->signal_key_release_event().connect(sigc::mem_fun(this, &Control::on_shortcut));

    Gtk::Label *label;
    builder->get_widget("scale_warning_label", label);
    _drawArea.set_scale_warning_label(label);

    window->set_size_request(1920, 1080);

    return window;
}
Пример #4
0
bool VRGuiBits::toggleFullscreen(GdkEventKey* k) {
    if (k->keyval != 65480) return false;
    static bool fs = false;
    fs = !fs;

    Gtk::Window* win; VRGuiBuilder()->get_widget("window1", win);
    Gtk::Separator* hs1; VRGuiBuilder()->get_widget("hseparator1", hs1);
    Gtk::Table* tab; VRGuiBuilder()->get_widget("table20", tab);
    Gtk::Notebook* nb1; VRGuiBuilder()->get_widget("notebook1", nb1);
    Gtk::Box* hb1; VRGuiBuilder()->get_widget("hbox1", hb1);

    if (fs) {
        win->fullscreen();
        nb1->hide();
        hb1->hide();
        tab->hide();
        hs1->hide();
        gtk_widget_hide(term_box);
    } else {
        win->unfullscreen();
        win->show_all();
    }

    return true;
}
Пример #5
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);
}
Пример #6
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);
}
Пример #7
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;
}	
Пример #8
0
Gtk::Window * Inkscape::UI::window_new (const gchar *title, unsigned int resizeable)
{
    Gtk::Window *window = new Gtk::Window(Gtk::WINDOW_TOPLEVEL);
    window->set_title (title);
    window->set_resizable (resizeable);
    window->signal_key_press_event().connect(sigc::ptr_fun(&on_window_key_press));

    return window;
}
Пример #9
0
void ResolutionDialog::applyResolution( Gtk::Widget * widget, const int width, const int height )
{
	Gtk::Window * top = dynamic_cast< Gtk::Window * >( widget->get_toplevel() );
	
	widget->set_size_request( width, height );
	top->unmaximize();
	top->unfullscreen();
	top->resize( width, height );
}
Пример #10
0
/**
 * Remove focus from window to whoever it is transient for.
 */
void sp_dialog_defocus_cpp(Gtk::Window *win)
{
    //find out the document window we're transient for
    Gtk::Window *w = win->get_transient_for();

    //switch to it
    if (w) {
        w->present();
    }
}
Пример #11
0
void RunMViewer()
{
    Gtk::Window win;
    win.set_title("MViewer");

    win.set_default_size(800, 600);
    PackTrackWindow(win, bb::bind(&PackMonitor, _1, _2, _3));

    RunWindow(win);
}
int main(int argc, char *argv[])
{
  Glib::RefPtr<Gtk::Application> app =
    Gtk::Application::create(argc, argv,
      "org.gtkmm.examples.base");

  Gtk::Window window;
  window.set_default_size(200, 200);

  return app->run(window);
}
Пример #13
0
void TestExampleDA(DAExposeFunc ef)
{
    InitGtkmm();

    ExampleDA da(ef);

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

    RunWindow(win);
}
Пример #14
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);
}
Пример #15
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);
}
Пример #16
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;
}	
Пример #17
0
int main(int argc, char *argv[])
{
	Glib::RefPtr<Gtk::Application> app = 
		Gtk::Application::create(argc, argv,
			 "tutorial1");

	Gtk::Window window;
	
	window.set_default_size(400,200);
	window.set_title("Tutorial 1");

	return app->run(window);	
}
Пример #18
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;
}
Пример #19
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;
}
Пример #20
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);
}
Пример #21
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);
}
Пример #22
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);
}
Пример #23
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;
}
Пример #24
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;
}
Пример #25
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);
}
Пример #26
0
bool EventManager::onKeyPress(GdkEventKey* ev, Gtk::Widget* widget)
{
	if (dynamic_cast<Gtk::Window*>(widget) != NULL)
	{
		Gtk::Window* window = static_cast<Gtk::Window*>(widget);

		// Pass the key event to the connected window and see if it can process it (returns TRUE)
		bool keyProcessed = gtk_window_propagate_key_event(window->gobj(), ev);

		// Get the focus widget, is it an editable widget?
		Gtk::Widget* focus = window->get_focus();
		bool isEditableWidget = dynamic_cast<Gtk::Editable*>(focus) != NULL || dynamic_cast<Gtk::TextView*>(focus) != NULL;

		// Never propagate keystrokes if editable widgets are focused
		if ((isEditableWidget && ev->keyval != GDK_Escape) || keyProcessed)
		{
			return keyProcessed;
		}
	}

	// Try to find a matching accelerator
	AcceleratorList accelList = findAccelerator(ev);

	if (!accelList.empty())
	{
		// Release any modifiers
		_modifiers.setState(0);

		// Fake a "non-modifier" event to the MouseEvents class
		GdkEventKey eventKey = *ev;
		eventKey.state &= ~(GDK_MOD1_MASK|GDK_SHIFT_MASK|GDK_CONTROL_MASK);
		_mouseEvents.updateStatusText(&eventKey);

		// Pass the execute() call to all found accelerators
		for (AcceleratorList::iterator i = accelList.begin(); i != accelList.end(); ++i)
		{
			i->keyDown();
		}

		return true;
	}

	_modifiers.updateState(ev, true);

	updateStatusText(ev, true);

	return false;
}
Пример #27
0
void CamWnd::connectWindowStateEvent(Gtk::Window& window)
{
    // Connect to the window-state-event signal
    _windowStateConn = window.signal_window_state_event().connect(
        sigc::mem_fun(*this, &CamWnd::onWindowStateEvent)
    );
}
Пример #28
0
Gobby::HueButton::HueButton(const Glib::ustring& title, Gtk::Window& parent):
	m_title(title), m_parent(parent), m_saturation(1.0), m_value(1.0)
{
	parent.signal_hide().connect(
		sigc::mem_fun(*this, &HueButton::on_parent_hide));
	set_hue(1.0);
}
Пример #29
0
Ganash::ApplicationWindow *Ganash::Application::get_main_window()
{
  Ganash::Application *application = Ganash::Application::instance();
  Ganash::ApplicationWindow *win;
  std::vector<Gtk::Window*> windows = application->get_windows();

  std::vector<Gtk::Window*>::iterator i;
  for( i = windows.begin(); i != windows.end(); i++ )
    {
      Gtk::Window *w = *i;
      if( w->get_name() == "gtkmm__GtkApplicationWindow")
        {
          win = static_cast<Ganash::ApplicationWindow *>(w);
        }
    }
  return win;
}
Пример #30
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;
}