JoystickListWidget::JoystickListWidget()
  : Gtk::Dialog("Joystick Preferences"),
    label("Below is a list of available joysticks on the system. Press Refresh to "
          "update the list, press Properties to get a separate device dialog. The "
          "devices listed are only joystick devices, not evdev devices or SDL "
          "devices, you can view the other ones via the top tab.")
    //frame("Device List"),
{
  set_has_separator(false);
  set_default_size(450, 310);

  label.set_line_wrap();

  scrolled.set_border_width(5);
  scrolled.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
  scrolled.add(treeview);
  get_vbox()->add(scrolled);

  add_button(Gtk::Stock::REFRESH, 2);
  add_button(Gtk::Stock::PROPERTIES, 1);
  add_button(Gtk::Stock::CLOSE, 0);

  signal_response().connect(sigc::mem_fun(this, &JoystickListWidget::on_response));

  // Set model
  device_list = Gtk::ListStore::create(DeviceListColumns::instance());
  treeview.set_model(device_list);
  treeview.set_headers_visible(false);
  treeview.append_column("Icon", DeviceListColumns::instance().icon);
  treeview.append_column("Name", DeviceListColumns::instance().name);

  treeview.signal_row_activated().connect(sigc::mem_fun(this, &JoystickListWidget::on_row_activated));

  on_refresh();
}
Esempio n. 2
0
SettingsWindow::SettingsWindow( Glib::ustring title, Gtk::Window& parent ) :
	Gtk::Dialog( title, parent, true, true  )
{
	// Update the lable below
	//
	f_table.set_row_spacings( 1 );

	f_initStat = GetStatMgr().lock()->GetStat( GetStatMgr().lock()->initId() );

	FillMainBox();
	UpdateDialog();

	//
	// Lower buttons
	//
	if( alternative_button_order( Glib::RefPtr<const Gdk::Screen>(0) ) )
	{
		add_button( Gtk::Stock::OK      , Gtk::RESPONSE_OK     	);
		add_button( Gtk::Stock::CANCEL  , Gtk::RESPONSE_CANCEL 	);
	}
	else
	{
		add_button( Gtk::Stock::CANCEL  , Gtk::RESPONSE_CANCEL 	);
		add_button( Gtk::Stock::OK      , Gtk::RESPONSE_OK     	);
	}
	
	show_all_children();
}
Esempio n. 3
0
void		init_buttons(t_lst **buttons)
{
  *buttons =
    new_button("Connect to server", (1920 - 500) / 2, 200, &connect_srv);
  add_button(my_strdup("Fullscreen: off"), *buttons, &set_fullscreen);
  add_button("Exit", *buttons, &close_game);
}
Esempio n. 4
0
statistics_dialog::statistics_dialog(game_display &disp,
		const std::string& title,
		const unsigned int team,
		const std::string& team_id,
		const std::string& player) :
	dialog(disp.video(), title, "", gui::NULL_DIALOG),
	detail_btn_(new gui::standard_dialog_button(disp.video(), _("Details"), 0 , false)),
	toggle_btn_(new gui::dialog_button(disp.video(), "", gui::button::TYPE_PRESS, BUTTON_TOGGLE)),
	scene_btn_(new gui::dialog_button(disp.video(), _("Select Scenario"), gui::button::TYPE_PRESS, BUTTON_SCENE)),
	player_name_(player),
	campaign_(statistics::calculate_stats(team_id)),
	scenarios_(statistics::level_stats(team_id)),
	scenario_index_(scenarios_.size() - 1), // current scenario
	team_num_(team),
	unit_count_(5,0)
{
	if ( scenarios_.size() > 1 ) {
		add_button(scene_btn_, gui::dialog::BUTTON_EXTRA_LEFT);
		add_button(toggle_btn_, gui::dialog::BUTTON_EXTRA_LEFT);
	}
	add_button(detail_btn_, gui::dialog::BUTTON_EXTRA);
	add_button(new gui::standard_dialog_button(disp.video(), _("Close"), 1, true),
	           gui::dialog::BUTTON_STANDARD);

	// Initialize the displayed data.
	if ( use_campaign_  ||  scenarios_.size() == 1 )
		display_stats(use_campaign_);
	else {
		// Starting with the scenario stats, but we need to make sure the
		// window is wide enough for the campaign stats.
		display_stats(true);
		layout();
		display_stats(false);
	}
}
Esempio n. 5
0
void
ExpireDialog::init()
{
    _spinner.set_numeric (true);
    _spinner.set_digits (1);
    _spinner.set_range (0, 30);
    _spinner.set_snap_to_ticks();
    _spinner.set_adjustment (_adj);
    _spinner.set_value (AppContext::get().get_expire());

    Gtk::VBox *vbox = get_vbox();
    vbox->pack_start (_label1, Gtk::PACK_SHRINK, 10);
    _box.add (*new Gtk::HBox);
    _box.pack_start (_spinner, Gtk::PACK_SHRINK, 10);
    _box.pack_start (_label2, Gtk::PACK_SHRINK, 0);
    _box.add (*new Gtk::HBox);
    vbox->pack_start (_box, Gtk::PACK_EXPAND_PADDING, 10);

    add_button (_("Do expire"), 1);
    add_button (Gtk::Stock::CANCEL, 0);

    /// Move focus to Do button
    cwidget_list_t list = get_action_area()->get_children();
    for (cwidget_list_t::iterator it = list.begin(); it != list.end(); ++it)
        if (get_response_for_widget (**it) == 1)
        { const_cast<Widget&>(**it).grab_focus(); break; }
    
    _changed_connection = _adj.signal_value_changed().connect (
            sigc::mem_fun (*this, &ExpireDialog::on_value_changed));
    
    show_all();
}
Esempio n. 6
0
DlgDownload::DlgDownload(){
  add_button (Gtk::Stock::OK,     Gtk::RESPONSE_OK);
  add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  signal_response().connect(
      sigc::hide(sigc::mem_fun(this, &DlgDownload::hide_all)));

  cb_w   = manage(new Gtk::CheckButton("Waypoints"));
  cb_a   = manage(new Gtk::CheckButton("Active log"));
  cb_o   = manage(new Gtk::CheckButton("Saved tracks"));
  Gtk::VButtonBox * bbox =  manage(new Gtk::VButtonBox);
  bbox->add(*cb_w);
  bbox->add(*cb_a);
  bbox->add(*cb_o);
  Gtk::Frame * frame =
    manage(new Gtk::Frame("Select data to be downloaded:"));
  frame->add(*bbox);

  Gtk::Label * l_dev =
    manage(new Gtk::Label("GPS device:", Gtk::ALIGN_RIGHT));
  e_dev = manage(new Gtk::Entry);

  cb_off = manage(new Gtk::CheckButton("Turn off device after download"));

  Gtk::Table * table = manage(new Gtk::Table(2,3));
  table->attach(*frame,  0,2, 0,1, Gtk::FILL, Gtk::SHRINK, 3,3);
  table->attach(*l_dev,  0,1, 1,2, Gtk::SHRINK, Gtk::SHRINK, 3,3);
  table->attach(*e_dev,  1,2, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 3,3);
  table->attach(*cb_off, 0,2, 2,3, Gtk::FILL, Gtk::SHRINK, 3,3);

  get_vbox()->add(*table);
}
Esempio n. 7
0
Gobby::FindDialog::FindDialog(GtkDialog* cobject,
                              const Glib::RefPtr<Gtk::Builder>& builder):
	Gtk::Dialog(cobject), m_folder(NULL), m_status_bar(NULL)
{
	builder->get_widget("search-for", m_entry_find);
	builder->get_widget("replace-with-label", m_label_replace);
	builder->get_widget("replace-with", m_entry_replace);

	builder->get_widget("match-case", m_check_case);
	builder->get_widget("match-entire-word-only", m_check_whole_word);
	builder->get_widget("search-backwards", m_check_backwards);
	builder->get_widget("wrap-around", m_check_wrap_around);

	m_entry_find->signal_changed().connect(
		sigc::mem_fun(*this, &FindDialog::on_find_text_changed));
	m_entry_replace->signal_changed().connect(
		sigc::mem_fun(*this, &FindDialog::on_replace_text_changed));

	add_button(_("_Close"), Gtk::RESPONSE_CLOSE);
	m_button_replace_all = add_button(_("Replace _All"),
	                                  RESPONSE_REPLACE_ALL);
	m_button_replace = add_button(_("_Replace"), RESPONSE_REPLACE);
	add_button(_("_Find"), RESPONSE_FIND);

	set_default_response(RESPONSE_FIND);
}
Esempio n. 8
0
Gobby::EntryDialog::EntryDialog(Gtk::Window& parent,
                                const Glib::ustring& title,
                                const Glib::ustring& label):
	Gtk::Dialog(title, parent, true, true), m_label(label), m_box(false, 5),
	m_check_valid_entry(false)
{
	m_entry.set_activates_default(true);

	m_box.pack_start(m_label);
	m_box.pack_start(m_entry);

	get_vbox()->set_spacing(5);
	get_vbox()->pack_start(m_box);

	m_entry.signal_changed().connect(
		sigc::mem_fun(*this, &EntryDialog::on_entry_changed)
	);

	add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
	set_default_response(Gtk::RESPONSE_OK);

	show_all();
	set_border_width(10);
	set_resizable(false);
}
Esempio n. 9
0
GUI *add_option(int x, int y, int w, int h, const char *txt, int act)
{
	GUI *B = new GUI();
	B->type = GUI_OPTION;
	B->action = act;
	B->x = x;
	B->y = y;
	B->width = w;
	B->height = h;
    B->text[0] = '\0';
    strcpy(B->text, txt);
	
	GUI *G = gui;
	while(G != NULL)
	{
		if(G->next == NULL)
		{
			G->next = B;
			B->next = NULL;
			break;
		}
		G = G->next;
	}

	int startx = x - (w/2);
	int starty = y - (h/2);
	int bw = w * 0.12;
	add_button(startx-bw-2,starty, bw,9+h, "<", act);
	add_button(startx+w+2,starty, bw,9+h, ">", act);

	return B;
}
Esempio n. 10
0
KeyboardControl::KeyboardControl(ContainerWindow &parent,
                                 const DialogLook &_look,
                                 PixelScalar x, PixelScalar y,
                                 UPixelScalar width, UPixelScalar height,
                                 OnCharacterCallback_t function,
                                 const WindowStyle _style)
  :look(_look),
  num_buttons(0),
  button_width(50), button_height(50),
  mOnCharacter(function)
{
  set(parent, x, y, width, height, _style);
  set_buttons_size();

  TCHAR caption[] = _T(" ");

  for (const TCHAR *i = keyboard_letters; !StringIsEmpty(i); ++i) {
    caption[0] = *i;

    add_button(caption);
  }

  add_button(_T(" Space "));
  add_button(_T("."));
  add_button(_T(","));
  add_button(_T("-"));

  move_buttons();
}
Esempio n. 11
0
void kb_strobe(void)
{
	uint16_t cols_[] = cols;
	uint16_t rows_[] = rows;

	for (uint8_t col=0; col<cols_num; col++)//Перебираем все строки
	{
		for (uint8_t i=0; i<cols_num; i++)//Формируем маску
		{
			if (i == col){KB_PORT->ODR &= ~cols_[i];}
			else{ KB_PORT->ODR |= cols_[i];}
		}

		for (uint8_t row=0; row<rows_num; row++)//Опрашиваем построчно
		{
			if ((KB_PORT->IDR & rows_[row]) == 0)
			{
				check_buttons[col][row]++;
			}
			else{
				if (check_buttons[col][row] >= trashhold1 &&
						check_buttons[col][row] <= trashhold2){
					add_button(col, row, '0');//0 means short press
				}
				if(check_buttons[col][row] > trashhold2){
					add_button(col, row, '1');//1 means long press
				}

				check_buttons[col][row]=0;
			}
		}
	}
}
Esempio n. 12
0
Gobby::FileChooser::Dialog::Dialog(Gobby::FileChooser& chooser,
                                   Gtk::Window& parent,
                                   const Glib::ustring& title,
                                   Gtk::FileChooserAction action):
	Gtk::FileChooserDialog(parent, title, action),
	m_chooser(chooser)
{
	// Set defaults depending on action
	switch(action)
	{
	case Gtk::FILE_CHOOSER_ACTION_SAVE:
		add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
		add_button(_("_Save"), Gtk::RESPONSE_ACCEPT);
		set_do_overwrite_confirmation(true);
		break;
	case Gtk::FILE_CHOOSER_ACTION_OPEN:
		add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
		add_button(_("_Open"), Gtk::RESPONSE_ACCEPT);
		break;
	default:
		g_assert_not_reached();
		break;
	}

	set_local_only(false);
	set_current_folder_uri(m_chooser.get_current_folder_uri());
}
Esempio n. 13
0
file_dialog::file_dialog(display &disp, const std::string& file_path,
		const std::string& title, bool show_directory_buttons) :
	gui::dialog(disp, title, file_path, gui::OK_CANCEL),
	show_directory_buttons_(show_directory_buttons),
	files_list_(NULL),
	last_selection_(-1),
	last_textbox_text_(),
	chosen_file_(".."),
    autocomplete_(true)
{
	files_list_ = new gui::file_menu(disp.video(), file_path);
	const unsigned file_list_height = (disp.h() / 2);
	const unsigned file_list_width = std::min<unsigned>(files_list_->width(), (disp.w() / 4));
	files_list_->set_measurements(file_list_width, file_list_height);
	files_list_->set_max_height(file_list_height);
	set_menu(files_list_);
	get_message().set_text(format_dirname(files_list_->get_directory()));
	set_textbox(_("File: "), format_filename(file_path), 100);
	if (show_directory_buttons_)
	{
		add_button( new gui::dialog_button(disp.video(), _("Delete File"),
					gui::button::TYPE_PRESS, gui::DELETE_ITEM), dialog::BUTTON_EXTRA);
		add_button( new gui::dialog_button(disp.video(), _("New Folder"),
					gui::button::TYPE_PRESS, gui::CREATE_ITEM), dialog::BUTTON_EXTRA_LEFT);
	}
}
Esempio n. 14
0
ParamsDialog::ParamsDialog(MainWindow *_mw) : Gtk::Dialog("Parameters", *_mw, true),
	mw(_mw)
{
	add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::ResponseType::RESPONSE_OK);

	Gtk::Box* box = get_vbox();
	Gtk::Table *tbl = Gtk::manage(new Gtk::Table(3,2));

	f_c_re = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_re->set_activates_default(true);
	f_c_im = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_im->set_activates_default(true);

	zc = Gtk::manage(new ZoomControl(mw));

	Gtk::Label* label;

	label = Gtk::manage(new Gtk::Label("Centre Real (x) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 0, 1);
	tbl->attach(*f_c_re, 1, 2, 0, 1);

	label = Gtk::manage(new Gtk::Label("Centre Imaginary (y) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 1, 2);
	tbl->attach(*f_c_im, 1, 2, 1, 2);

	tbl->attach(*zc, 0, 2, 2, 3);

	box->pack_start(*tbl);
	set_default_response(Gtk::ResponseType::RESPONSE_OK);
}
Esempio n. 15
0
static void make_buttons( HWND hwnd )
{
    int     offset;
    int     max_height;
    int     btn_width;
    int     btn_height;
    static int buttons[] = {
        IDM_ROTATE_UP,
        IDM_MOVE_IN,
        IDM_ROTATE_LEFT,
        IDM_ROTATE_RIGHT,
        IDM_MOVE_OUT,
        IDM_ROTATE_DOWN,
        IDM_MORE_BRIGHTNESS,
        IDM_LESS_BRIGHTNESS,
        0 };
    int index;

    Draw_area.yTop -= 2;
    offset = Draw_area.xLeft + 2;
    max_height= 0;
    for( index = 0; buttons[index]; ++ index, offset += btn_width - 1 ) {
        #if 0
        if( index == 0 ) {
             add_button( hwnd, Draw_area.yTop, offset, buttons[index], NULL, &btn_height );
        } else
        #endif
        add_button( hwnd, Draw_area.yTop, offset, buttons[index], &btn_width, &btn_height );
        if( max_height < btn_height ) max_height = btn_height;
    }
    // Remove buttons from drawing area
    Draw_area.yTop -= max_height + 2;
    Button_height = max_height + 4;
}
Esempio n. 16
0
void		init_connect(t_lst **buttons)
{
  *buttons = new_button("IP address", (1920 - 500) / 2, 200, &input_address);
  add_button("Server port", *buttons, &input_port);
  add_button("Player name", *buttons, &input_pseudo);
  add_button("Connect!", *buttons, &connecting);
  add_button("Go away, I'm alone", *buttons, &menu);
}
Esempio n. 17
0
PopupConfirmation::PopupConfirmation(std::string title, Gtk::Window* parent, std::string msg) 
: Gtk::Dialog(title, *parent), boiteV(get_vbox()), label(msg)
{
	boiteV->pack_start(label);

	add_button("YES", Gtk::RESPONSE_OK);
	add_button("NO", Gtk::RESPONSE_CANCEL);
	show_all();
}
Esempio n. 18
0
Button* AcceptDialog::add_cancel(const String &p_cancel) {

	String c = p_cancel;
	if (p_cancel=="")
		c="Cancel";
	Button *b = swap_ok_cancel ? add_button(c,true) : add_button(c);
	b->connect("pressed",this,"_closed");
	return b;
}
Esempio n. 19
0
void
create_toolbar_button_dialog(ToolbarButton **tb)
{
  GtkWidget *dialog_vbox;
  GtkWidget *action_area;
  GtkWidget *table;
  GList *tmp, *strings = NULL;

  dialog = gtk_dialog_new();
  dialog_vbox = GTK_DIALOG(dialog)->vbox;
  action_area = GTK_DIALOG(dialog)->action_area;
  gtk_container_set_border_width(GTK_CONTAINER(dialog_vbox), 5);
  gtk_box_set_spacing(GTK_BOX(dialog_vbox), 5);
  gtk_signal_connect(GTK_OBJECT(dialog), "delete_event", delete_event_cb, NULL);
  gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
                     GTK_SIGNAL_FUNC(key_press_cb), NULL);

  table = add_table(dialog_vbox, 2, 2, FALSE, FALSE, 0);
  gtk_table_set_row_spacings(GTK_TABLE(table), 5);

  add_label_to_table(table, _("Label: "), 0.0, 0, 1, 0, 1);
  add_label_to_table(table, _("Tooltip: "), 0.0, 0, 1, 1, 2);
  title_entry = add_entry_to_table(table, "", 1, 2, 0, 1);
  tooltip_entry = add_entry_to_table(table, "", 1, 2, 1, 2);

  table = add_framed_table(dialog_vbox, _("Action: "), 2, 2, FALSE, 0);

  shell_radio_button = add_radio_button_to_table(table, _("Command: "), NULL,
                FALSE, shell_radio_cb, NULL, 0, 1, 0, 1);
  action_entry = add_entry_to_table(table, "", 1, 2, 0, 1);

  if (*tb != NULL)
  {
    gtk_entry_set_text(GTK_ENTRY(title_entry), (*tb)->label);
    gtk_entry_set_text(GTK_ENTRY(tooltip_entry), (*tb)->tooltip);
    gtk_entry_set_text(GTK_ENTRY(action_entry), (*tb)->action);
  }
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shell_radio_button), TRUE);

  gtk_signal_connect(GTK_OBJECT(title_entry), "activate", 
                     GTK_SIGNAL_FUNC(ok_cb), tb);

  gtk_signal_connect(GTK_OBJECT(tooltip_entry), "activate", 
                     GTK_SIGNAL_FUNC(ok_cb), tb);

  gtk_signal_connect(GTK_OBJECT(action_entry), "activate", 
                     GTK_SIGNAL_FUNC(ok_cb), tb);

  gtk_widget_grab_focus(title_entry);

  add_button(action_area, _("Ok"), TRUE, 0, ok_cb, tb);
  add_button(action_area, _("Info"), TRUE, 0, help_cb, NULL);
  add_button(action_area, _("Cancel"), TRUE, 0, cancel_cb, NULL);

  gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
  gtk_widget_show(dialog);
}
Esempio n. 20
0
DamageWindow::DamageWindow( Glib::ustring title, Gtk::Window& parent ) :
	Gtk::Dialog( title, parent, true, true ),
	f_value(0)
{
	Gtk::Label* label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	f_table.AddItem( Name, gettext("Character Name"), false, label, NULL );
	//
	label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	label->set_use_markup( true );
	f_table.AddItem( HitPoints, gettext("Current Hit Points"), false, label, NULL );
	//
	label = new Gtk::Label(" ", Gtk::ALIGN_LEFT);
	label->set_justify( Gtk::JUSTIFY_LEFT );
	label->set_use_markup( true );
	f_table.AddItem( TempHP, gettext("Temporary Hit Points"), false, label, NULL );
	//
	Gtk::Adjustment* adj = Gtk::manage( new Gtk::Adjustment(0.0, 0.0, 10000.0) );
	f_spinButton  = new Gtk::SpinButton;
	f_spinButton->configure( *adj, 0.0, 0 );
	f_spinButton->set_numeric( true );
	f_table.AddItem( DamageHealth, gettext("Enter new damage/health"), false, f_spinButton, NULL );

	// Pack children into a vbox and add buttons
	//
	Gtk::VBox* vbox = get_vbox();
	vbox->pack_start( f_table );
	//
	// Respect system-dependent alternative button order (defined
	// in gtk+ theme).
	//
	const bool alternative_order = alternative_button_order( Glib::RefPtr<const Gdk::Screen>(0) );
	//
	if( !alternative_order )
	{
		add_button( Gtk::Stock::CANCEL,		Gtk::RESPONSE_CANCEL );
	}
	//
	add_button( gettext("Bring to _Full"),	RESPONSE_FULLHEATH   );
	add_button( gettext("Add _Health"),	RESPONSE_HEALTH      );
	add_button( gettext("Add _Damage"),	Gtk::RESPONSE_OK     );
	//
	if( alternative_order )
	{
		add_button( Gtk::Stock::CANCEL,		Gtk::RESPONSE_CANCEL );
	}

	// Dialog stuff
	//
	set_default_response( Gtk::RESPONSE_OK );
	activate_default();
	show_all_children();
}
Esempio n. 21
0
static int rnb4_rotator_probe(struct platform_device *pdev)
{
    struct rnb4_rot_input *rnb4_rot_input;
    struct input_dev *input_dev;
    int err = 0;

    rnb4_rot_input = kzalloc(sizeof(struct rnb4_rot_input), GFP_KERNEL);

    if (!rnb4_rot_input) {
        return -ENOMEM;
    }

    input_dev = input_allocate_device();

    if (!input_dev) {
        err = -ENOMEM;
        goto input_failure;
    }

    /* input layer init */
    rnb4_rot_input->input = input_dev;

    rnb4_rot_input->irq[0] = 0xFF; rnb4_rot_input->gpio[0] = 0xFF;
    rnb4_rot_input->irq[1] = 0xFF; rnb4_rot_input->gpio[1] = 0xFF;

    input_dev->name = DRIVER_NAME;
    input_dev->phys = DRIVER_NAME"/input0";

    input_dev->id.bustype = BUS_HOST;
    input_dev->id.vendor = 0x0001;
    input_dev->id.product = 0x0001;
    input_dev->id.version = DRIVER_VERSION;
    input_dev->evbit[0] = BIT(EV_KEY);

    add_button(118, KEY_UP, rnb4_rot_input);
    add_button(119, KEY_DOWN, rnb4_rot_input);

    err = input_register_device(rnb4_rot_input->input);

    if (err)
        goto no_enter_irq;

    platform_set_drvdata(pdev, rnb4_rot_input);
    dev_info(&pdev->dev, "driver loaded\n");

    goto ok;

no_enter_irq:
    clean_irq_and_input(rnb4_rot_input);
input_failure:
    kfree(rnb4_rot_input);
ok:
    return err;
}
Esempio n. 22
0
void	Window::show_menu2()
{
  gtk_container_remove(GTK_CONTAINER(window), table);
  table = gtk_table_new(3, 1, TRUE);
  gtk_container_add(GTK_CONTAINER(window), table);
  add_button("Back", "clicked", 0, 1, 1, 2,
	     G_CALLBACK(openMainMenu), (gpointer)this);
  add_button("Quit", "clicked", 0, 1, 2, 3,
	     G_CALLBACK(delete_event), NULL);
  gtk_widget_show(table);
  gtk_widget_show(window);
}
Esempio n. 23
0
SettingsManager::SettingsManager():on_change_settings(this, CBT_CHANGE_SETTINGS) {
	set_title("Settings manager");
	menu.set_size_request(160, 200);

	pFixed.add(props);
	pFixed.signal_size_allocate().connect(sigc::mem_fun(*this, &SettingsManager::props_on_size_allocate));
	pFixed.signal_button_press_event().connect(sigc::mem_fun(props, &PropEditor::on_button_press_event));
	pFixed.signal_button_release_event().connect(sigc::mem_fun(props, &PropEditor::on_button_release_event));
	pFixed.signal_motion_notify_event().connect(sigc::mem_fun(props, &PropEditor::on_motion_notify_event));
	pScroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
	pScroll.add(pFixed);
//	pScroll.set_size_request(300, 200);

	info.set_size_request(100, 40);
	info.set_editable(false);
	info.set_wrap_mode(WRAP_WORD);

	hpaned.pack1(menu, false, false);
	hpaned.pack2(vpaned, true, true);
	vpaned.pack1(pScroll, true, true);
	vpaned.pack2(info, false, false);

	hpaned.show_all();
	get_vbox()->pack_start(hpaned, true, true);

	menuStore = Gtk::ListStore::create(menuColumns);
	menu.set_model(menuStore);
	menu.append_column("icon", menuColumns.icon);
	menu.append_column("name", menuColumns.name);
	menu.set_headers_visible(false);
	menu.signal_cursor_changed().connect(sigc::mem_fun(*this, &SettingsManager::on_show_ep_row_activated));

	add_button(Gtk::Stock::ADD, 4);
	add_button(Gtk::Stock::OPEN, 3);
	add_button(Gtk::Stock::SAVE, 2);
	add_button(Gtk::Stock::OK, 1);

	set_icon_from_file(dataDir + ICONS_PATH + "tools.png");

	void *id = mdb.begin_read_settings(0);
	ParamInfo param;
	while(mdb.read_settings(id, param)) {
		Gtk::TreeRow row = *(menuStore->append());
		row[menuColumns.name] = param.title;
		row[menuColumns.info] = param.info;
		row[menuColumns.icon] = Gdk::Pixbuf::create_from_file(dataDir + ICONS_PATH + param.list + ".png");
		row[menuColumns.id] = param.id;
	}
	mdb.end_read(id);

	props.on_change_property += this;
	props.on_select_property += this;
}
Esempio n. 24
0
void c_SelectPointsDlg::InitControls(bool hasAutoBtn)
{
    m_ImgView.signal_ImageAreaBtnPress().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnImageBtnPress));

    m_ImgView.signal_DrawImageArea().connect(sigc::slot<bool, const Cairo::RefPtr<Cairo::Context>&>(
        [this](const Cairo::RefPtr<Cairo::Context> &cr)
        {
            for (auto &pt: m_Points)
                Utils::DrawAnchorPoint(cr,
                                       m_ImgView.GetZoomPercentVal() * pt.x / 100,
                                       m_ImgView.GetZoomPercentVal() * pt.y / 100);

            return false;
        }
    ));
    m_ImgView.show();

    Gtk::Button *btnRemovePts = Gtk::manage(new Gtk::Button(_("Remove points")));
    btnRemovePts->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnRemoveClick));
    btnRemovePts->show();

    Gtk::Button *btnAuto = 0;
    if (hasAutoBtn)
    {
        btnAuto = Gtk::manage(new Gtk::Button(_("Automatic")));
        btnAuto->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnAutoClick));
        btnAuto->show();
    }

    Gtk::HButtonBox *btnBox = Gtk::manage(new Gtk::HButtonBox());
    btnBox->set_layout(Gtk::ButtonBoxStyle::BUTTONBOX_START);
    btnBox->pack_start(*btnRemovePts, Gtk::PackOptions::PACK_SHRINK);
    if (hasAutoBtn)
    {
        btnBox->pack_start(*btnAuto, Gtk::PackOptions::PACK_SHRINK);
    }
    btnBox->show();
    get_content_area()->pack_start(*btnBox, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    get_content_area()->pack_start(m_ImgView, Gtk::PackOptions::PACK_EXPAND_WIDGET, Utils::Const::widgetPaddingInPixels);

    m_InfoText.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
    m_InfoText.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
    m_InfoText.set_lines(2);
    get_content_area()->pack_start(m_InfoText, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    auto separator = Gtk::manage(new Gtk::Separator());
    separator->show();
    get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    add_button(_("OK"), Gtk::RESPONSE_OK);
    add_button(_("Cancel"), Gtk::RESPONSE_CANCEL);
}
CreateWireframeDialog::CreateWireframeDialog(const Glib::ustring & title) :
    Dialog(title, true),
    m_filled(false),
    m_minVertices(false),
    m_coordBox(Gtk::manage(new CoordBox())),
    m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))),
    m_nameEntry(Gtk::manage(new Gtk::Entry()))
{
    set_size_request(-1, 230);
    set_resizable(false);
    set_border_width(10);

    // Entry for the name
    Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox());
    name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0);
    name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0);
    name_hbox->set_spacing(0);
    name_hbox->set_homogeneous(false);

    // Check box for filling
    Gtk::CheckButton * const filled_button = Gtk::manage(new Gtk::CheckButton("Filled shape"));
    filled_button->signal_toggled().connect(sigc::mem_fun(*this, &CreateWireframeDialog::on_filled_button_toggled));
    filled_button->set_active(false);

    get_content_area()->pack_start(*name_hbox, Gtk::PACK_SHRINK, 5);
    get_content_area()->pack_start(*filled_button, Gtk::PACK_SHRINK, 5);

    Gtk::Frame * const coord_frame = Gtk::manage(new Gtk::Frame("Points"));
    Gtk::ScrolledWindow * const scrolled_window = Gtk::manage(new Gtk::ScrolledWindow());

    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    scrolled_window->set_size_request(-1, 150);
    scrolled_window->set_border_width(5);
    scrolled_window->add(*m_coordBox);
    m_coordBox->set_spacing(0);
    coord_frame->add(*scrolled_window);
    get_content_area()->pack_start(*coord_frame, Gtk::PACK_SHRINK, 0);

    // Entries for the coordinates
    m_coordBox->add_coord();
    m_coordBox->add_coord();
    m_coordBox->add_coord();

    // Add buttons (from left to right)
    add_button("Cancel", Gtk::RESPONSE_CANCEL);
    add_button("Add point", Gtk::RESPONSE_APPLY);
    add_button("OK", Gtk::RESPONSE_OK);

    signal_response().connect_notify(sigc::mem_fun(*this, &CreateWireframeDialog::on_my_response));
    set_default_response(Gtk::RESPONSE_OK);
    show_all_children();
}
MarketBuildOptionsDialog::MarketBuildOptionsDialog(const std::string& CommonBuildOptions, const std::string& BuildOptions, const std::string FuncID)
: Gtk::Dialog(), m_CommonBuildOptions(CommonBuildOptions),m_BuildOptions(BuildOptions),m_FuncID(FuncID)
{

  set_size_request(450,-1);
  set_border_width(6);

  Gtk::Label* InfoLabel = Gtk::manage(new Gtk::Label());
  InfoLabel->set_markup(std::string("<i>")+_("These options control the builds of source packages.\nChanging this is at your own risk.")+std::string("</i>"));
  InfoLabel->set_justify(Gtk::JUSTIFY_CENTER);

  get_vbox()->pack_start(*InfoLabel);

  Gtk::Label* CommonOptsLabel = Gtk::manage(new Gtk::Label());

  if (!FuncID.empty())
    CommonOptsLabel->set_markup(_("<u>Common source build options:</u>\n")
                                +openfluid::tools::ReplaceEmptyString(CommonBuildOptions,_("<i>none</i>")));
  else
    CommonOptsLabel->set_label("");

  CommonOptsLabel->set_alignment(0,0.5);
  get_vbox()->pack_start(*CommonOptsLabel,Gtk::PACK_SHRINK,12);


  Gtk::Label* EditLabel = Gtk::manage(new Gtk::Label());
  if (!FuncID.empty())
  {
    EditLabel->set_label(_("Specific build options for ")+FuncID+_(":"));
  }
  else
  {
    EditLabel->set_label(_("Common source build options:"));
  }
  EditLabel->set_alignment(0,0.5);
  get_vbox()->pack_start(*EditLabel);

  if (FuncID.empty()) m_OptionsEntry.set_text(CommonBuildOptions);
  else m_OptionsEntry.set_text(BuildOptions);
  get_vbox()->pack_start(m_OptionsEntry);

  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  if(m_FuncID.empty())
    set_title(_("Common build options for all source packages"));
  else
    set_title(_("Build options for ") + m_FuncID);


  show_all_children();
}
	leader_scroll_dialog(display &disp, const std::string &title,
			std::vector<bool> &leader_bools, int selected,
			gui::DIALOG_RESULT extra_result) :
		dialog(disp, title, "", gui::NULL_DIALOG),
		scroll_btn_(new gui::standard_dialog_button(disp.video(), _("Scroll To"), 0, false)),
		leader_bools_(leader_bools),
		extra_result_(extra_result)
	{
		scroll_btn_->enable(leader_bools[selected]);
		add_button(scroll_btn_, gui::dialog::BUTTON_STANDARD);
		add_button(new gui::standard_dialog_button(disp.video(),
			_("Close"), 1, true), gui::dialog::BUTTON_STANDARD);
	}
Esempio n. 28
0
SimpleTypeBox::SimpleTypeBox(const std::string& title,
			     const std::string& value) :
    Gtk::Dialog(title,true,true),
    mBase(0),
    mValid(false)
{
    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    set_default_response(Gtk::RESPONSE_OK);
    makeDialog();
    mEntry->set_text(value);
    show_all();
}
Esempio n. 29
0
void DirList::load_current_dir() {
    set_draw_required();
    dir_list.clear();

    // Erase all dir buttons
    for (std::vector <TextButton*> ::iterator itr = buttons.begin();
     itr != buttons.end(); ++itr) {
        remove_child(**itr);
        delete *itr;
    }
    buttons.clear();

    if (!Help::dir_exists(current_dir))
        current_dir = base_dir;

    if (current_dir.get_rootful().size() > base_dir.get_rootful().size()) {
        real_buttons_per_page = bottom_button - 1;
    } else {
        real_buttons_per_page = bottom_button;
    }

    Help::find_dirs(current_dir, static_put_to_dir_list, (void*) this);
    std::sort(dir_list.begin(), dir_list.end());

    // Hochwechsler
    if (current_dir != base_dir) {
        add_button(0, Language::dir_parent);
        (**--buttons.end()).set_hotkey(useR->key_me_up_dir);
    }
    // Verzeichnisbuttons erstellen
    unsigned int next_from_dir_list = page * real_buttons_per_page;
    // Die folgende While-Schleife macht, dass bei mehreren Seiten immer
    // alle Seiten voll gefuellt sind. Die letzte Seite wird dann ggf. oben
    // mit Eintraegen der vorletzten Seite aufgefuellt.
    while (page > 0 && next_from_dir_list + real_buttons_per_page
           > dir_list.size()) --next_from_dir_list;
    for (unsigned int i = buttons.size();
     i < bottom_button && next_from_dir_list < dir_list.size(); ++i) {
        add_button(i, dir_list[next_from_dir_list]);
        ++next_from_dir_list;
    }
    // Blaetter-Button anhaengen, es sei denn, es geht genau auf
    if (next_from_dir_list == dir_list.size() - 1 && page == 0) {
        add_button(bottom_button, dir_list[next_from_dir_list]);
        ++next_from_dir_list;
    }
    // Das hier ist der Blaetter-Button
    else if (next_from_dir_list < dir_list.size() || page > 0) {
        add_button(bottom_button, Language::dir_flip_page);
    }
}
Esempio n. 30
0
void c_PreferencesDlg::InitControls()
{
    for (const Utils::Const::Language_t &lang: Utils::Const::languages)
    {
        m_UILanguage.append(lang.name == Utils::Const::SYSTEM_DEFAULT_LANG ? _("System language") : lang.name);
        if (lang.langId == std::string(Configuration::UILanguage))
            m_UILanguage.set_active(m_UILanguage.get_model()->children().size()-1);
    }

    get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>( {
                                        Gtk::manage(new Gtk::Label(_("User interface language:"))),
                                        &m_UILanguage } ),
                                   Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    int iconSizePx;
    Gtk::IconSize::lookup(Configuration::GetToolIconSize(), iconSizePx, iconSizePx);
    m_ToolIconSize.set_adjustment(Gtk::Adjustment::create(iconSizePx, MIN_ICON_SIZE_PIX, MAX_ICON_SIZE_PIX));
    m_ToolIconSize.set_digits(0);
    m_ToolIconSize.set_value_pos(Gtk::PositionType::POS_LEFT);
    for (unsigned sizeMark: { 8, 16, 24, 32, 40, 64, 80, 100, 128 })
        m_ToolIconSize.add_mark(sizeMark, Gtk::PositionType::POS_TOP, Glib::ustring::format(sizeMark));

    Gtk::HBox *boxToolIconSize = Gtk::manage(new Gtk::HBox());
    boxToolIconSize->pack_start(*Gtk::manage(new Gtk::Label(_("Tool icon size:"))), Gtk::PackOptions::PACK_SHRINK);
    boxToolIconSize->pack_start(m_ToolIconSize);
    boxToolIconSize->set_spacing(10);
    boxToolIconSize->show_all();

    get_content_area()->pack_start(*boxToolIconSize, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    m_ExportInactiveFramesQuality.set_label(_("Include inactive frames when exporting quality data"));
    m_ExportInactiveFramesQuality.set_active(Configuration::ExportInactiveFramesQuality);
    m_ExportInactiveFramesQuality.show();
    get_content_area()->pack_start(m_ExportInactiveFramesQuality, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    m_NumQualHistBins.set_adjustment(Gtk::Adjustment::create(Configuration::NumQualityHistogramBins, 10, Utils::Const::MaxQualityHistogramBins,
            1, 10, 10));
    get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>(
            { Gtk::manage(new Gtk::Label(_("Number of frame quality histogram bins:"))),
              &m_NumQualHistBins }),
            Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    auto separator = Gtk::manage(new Gtk::Separator());
    separator->show();
    get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    add_button(_("OK"), Gtk::RESPONSE_OK);
    add_button(_("Cancel"), Gtk::RESPONSE_CANCEL);

    //FIXME: not working when a Gtk::Entry has focus! #### set_default(*get_widget_for_response(Gtk::ResponseType::RESPONSE_OK));
}