本文整理汇总了C++中gtk::Entry类的典型用法代码示例。如果您正苦于以下问题:C++ Entry类的具体用法?C++ Entry怎么用?C++ Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: defaultButtonCB
void PreferencesDialogImpl::defaultButtonCB()
{
Config::defaultConfig();
m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]);
m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]);
}
开发者ID:Luminoth,项目名称:classview,代码行数:7,代码来源:PreferencesDialog.cpp
示例2: add
void dialog::operate4(Image imag,std::string filename)
{
set_default_size(300, 50);
set_border_width(10);
set_position(Gtk::WIN_POS_CENTER);
set_resizable(false);
Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
add(*vbox);
Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
vbox->add(*grid);
Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
grid->attach(*label,0,0,1,1);
Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
grid->attach(*bvalue, 1, 0, 1, 1);
Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
grid->attach(*label2,2,0,1,1);
set_title("Save As");
bvalue->set_text("Untitled");
bvalue->set_max_length(50);
Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
grid->attach(*bok, 2, 2, 1, 1);
show_all_children();
}
开发者ID:CS101-ProjectTeam,项目名称:Digital-Image-Processor,代码行数:29,代码来源:dialog.cpp
示例3: savePreferences
void PreferencesDialogImpl::savePreferences()
{
g_configMap[Config::EDITOR[0]] = m_editorEntry->get_text();
g_configMap[Config::CTAGS[0]] = m_ctagsEntry->get_text();
Config::write();
}
开发者ID:Luminoth,项目名称:classview,代码行数:7,代码来源:PreferencesDialog.cpp
示例4: cell_editing_started
//--------------------------------------------------------------------------------
void DbMySQLTableEditorFKPage::cell_editing_started(GtkCellRenderer* cr, GtkCellEditable* ce, gchar* path, gpointer udata)
{
DbMySQLTableEditorFKPage* self = reinterpret_cast<DbMySQLTableEditorFKPage*>(udata);
bec::NodeId node(path);
if ( node.is_valid() )
self->_fk_node = node;
if ( GTK_IS_ENTRY(ce) ) // Fill in name of the foreign key column
{
::bec::FKConstraintListBE *fk_be = self->_be->get_fks();
Gtk::Entry* entry = Glib::wrap(GTK_ENTRY(ce));
std::string name;
if (node.back() == fk_be->count()-1)
fk_be->set_field(node, bec::FKConstraintListBE::Name, 1);
fk_be->get_field(node, bec::FKConstraintListBE::Name, name);
entry->set_text(name);
}
// clean up edit_done signal/slotl
if ( self->_ce && self->_edit_conn )
{
g_signal_handler_disconnect (self->_ce, self->_edit_conn);
self->_ce = 0;
self->_edit_conn = 0;
}
if (GTK_IS_CELL_EDITABLE(ce))
{
self->_ce = ce;
self->_edit_conn = g_signal_connect(ce, "editing-done", GCallback(&DbMySQLTableEditorFKPage::cell_editing_done), udata);
}
}
开发者ID:abibell,项目名称:mysql-workbench,代码行数:36,代码来源:mysql_table_editor_fk_page.cpp
示例5: cell_editing_done
//--------------------------------------------------------------------------------
void DbMySQLTableEditorIndexPage::cell_editing_done(GtkCellEditable *ce) {
if (_editing_done_id != 0 && _editable_cell != 0) {
g_signal_handler_disconnect(_editable_cell, _editing_done_id);
_editing_done_id = 0;
_editable_cell = 0;
}
// If it's Gtk::Entry, we try to find out if maybe user leave edit field empty,
// if so we revert it to the last known value or to the default one.
if (GTK_IS_ENTRY(ce)) {
GtkEntry *entry_widget = GTK_ENTRY(ce);
if (entry_widget) {
Gtk::Entry *entry = Glib::wrap(entry_widget);
if (entry && entry->get_text_length() == 0) {
Gtk::TreeModel::Path path;
Gtk::TreeView::Column *column(0);
_indexes_tv->get_cursor(path, column);
bec::NodeId node(path.to_string());
if (node.is_valid()) {
std::string name = _user_index_name;
if (name.empty())
name = strfmt("index%i", path[0] + 1);
_be->get_indexes()->set_field(node, MySQLTableIndexListBE::Name, name);
entry->set_text(name);
}
}
}
}
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:32,代码来源:mysql_table_editor_index_page.cpp
示例6: switch
//------------------------------------------------------------------------------
std::string mforms::gtk::ToolBarImpl::get_item_text(mforms::ToolBarItem *item) {
std::string text;
switch (item->get_type()) {
case mforms::FlatSelectorItem:
case mforms::SelectorItem: {
Gtk::ComboBoxText *ct = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
if (ct)
text = ct->get_active_text();
break;
}
case mforms::ColorSelectorItem: {
const Gtk::ComboBox *combo = cast<Gtk::ComboBox *>(item->get_data_ptr());
if (combo) {
const Gtk::TreeIter iter = combo->get_active();
const Gtk::TreeRow row = *iter;
text = row.get_value(color_combo_columns->color);
}
break;
}
case mforms::SearchFieldItem: {
Gtk::Entry *e = cast<Gtk::Entry *>(item->get_data_ptr());
if (e)
text = e->get_text();
break;
}
default: {
Gtk::Widget *btn = cast<Gtk::Widget *>(item->get_data_ptr());
if (btn)
text = btn->get_name();
}
}
return text;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:36,代码来源:lf_toolbar.cpp
示例7: forceNumericEntry
/*! \brief This function is designed to be used in a Gtk::Entry's
signal_changed() callback. It enforces that the text is
formatted in the style of a numeric value.
It allows the first character to be a minus or plus sign, there
to be a sequence of digits, possibly split by one decimal point.
An example use is \code
entry.signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry,
entry)); \endcode
*/
inline void forceNumericEntry(::Gtk::Entry& textfield)
{
std::string value = textfield.get_text();
bool hasPoint = false;
bool hasExponent = false;
std::string::iterator iPtr = value.begin();
if ((*iPtr == '-') || (*iPtr == '+')) ++iPtr;
while (iPtr != value.end())
if (std::isdigit(*iPtr))
++iPtr;
else if ((*iPtr == '.') && (!hasPoint))
{ ++iPtr; hasPoint = true; }
else if ((*iPtr == 'e')
&& (!hasExponent)
&& (iPtr != value.begin())
&& std::isdigit(*(iPtr - 1)))
{
//If the last value was a digit we can have a single e
//argument, but don't allow decimal exponents
hasExponent=true;
hasPoint = true;
++iPtr;
//Eat the sign of the exponent
if ((*iPtr == '-') || (*iPtr == '+')) ++iPtr;
}
else
iPtr = value.erase(iPtr);
if (value[0] == '.') value.erase(value.begin());
textfield.set_text(value);
}
开发者ID:armando-2011,项目名称:DynamO,代码行数:45,代码来源:numericEntry.hpp
示例8: showDomainIDataEditDialog
std::string DialogBoxFactory::showDomainIDataEditDialog(int Id,
std::string DataName, std::string Val)
{
Gtk::Dialog Dialog(_("Edit Inputdata"), true, false);
Gtk::Entry Entry;
Entry.set_text(Val);
Gtk::Label Label(Glib::ustring::compose(_("%1 for ID %2"), DataName,Id));
Dialog.get_vbox()->pack_start(Label);
Dialog.get_vbox()->pack_start(Entry);
Dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
Dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
Dialog.set_default_response(Gtk::RESPONSE_OK);
Dialog.show_all_children();
int Res = Dialog.run();
if (Res == Gtk::RESPONSE_CANCEL || Res == Gtk::RESPONSE_DELETE_EVENT)
return Val;
std::string NewVal = Entry.get_text();
if (NewVal == "" || NewVal == " ")
NewVal = "0";
return NewVal;
}
开发者ID:VaysseB,项目名称:openfluid,代码行数:31,代码来源:DialogBoxFactory.cpp
示例9: signal_entry_changed
void ConnectView::signal_entry_changed()
{
// Use the value of the entry widget, rather than the
// active text, so the user can enter other values.
Gtk::Entry *entry = m_combo.get_entry();
m_settings->Hardware.PortName = entry->get_text();
}
开发者ID:attrezzo,项目名称:repsnapper,代码行数:7,代码来源:connectview.cpp
示例10: do_refresh_form_data
virtual void do_refresh_form_data()
{
Gtk::Entry *entry;
xml()->get_widget("name_entry", entry);
Gtk::TextView *tview;
xml()->get_widget("text_view", tview);
Gtk::ComboBox *combo;
xml()->get_widget("collation_combo", combo);
Gtk::Button *btn;
xml()->get_widget("refactor_btn", btn);
if (_be)
{
set_selected_combo_item(combo, _be->get_schema_option_by_name("CHARACTER SET - COLLATE"));
_old_name = _be->get_name();
entry->set_text(_old_name);
tview->get_buffer()->set_text(_be->get_comment());
bool is_editing_live_obj= is_editing_live_object();
tview->set_sensitive(!is_editing_live_obj);
Gtk::Label *tlabel;
xml()->get_widget("label5", tlabel);
tlabel->set_sensitive(!is_editing_live_obj);
btn->set_sensitive(_be->refactor_possible());
}
}
开发者ID:abibell,项目名称:mysql-workbench,代码行数:31,代码来源:schema_editor_fe.cpp
示例11: sp_attribute_table_entry_changed
static void sp_attribute_table_entry_changed ( Gtk::Entry *editable,
SPAttributeTable *spat )
{
if (!spat->blocked)
{
std::vector<Glib::ustring> attributes = spat->get_attributes();
std::vector<Gtk::Entry *> entries = spat->get_entries();
for (guint i = 0; i < (attributes.size()); i++) {
Gtk::Entry *e = entries[i];
if ((GtkWidget*)editable == (GtkWidget*)e->gobj()) {
spat->blocked = true;
Glib::ustring text = e->get_text ();
if (spat->_object) {
spat->_object->getRepr()->setAttribute(attributes[i].c_str(), text.c_str(), false);
DocumentUndo::done(spat->_object->document, SP_VERB_NONE,
_("Set attribute"));
}
spat->blocked = false;
return;
}
}
g_warning ("file %s: line %d: Entry signalled change, but there is no such entry", __FILE__, __LINE__);
}
} // end of sp_attribute_table_entry_changed()
开发者ID:Spin0za,项目名称:inkscape,代码行数:25,代码来源:sp-attribute-widget.cpp
示例12: set_to_gui
void Settings::set_to_gui (Builder &builder, int i)
{
const char *glade_name = settings[i].glade_name;
if (!glade_name)
return;
switch (settings[i].type) {
case T_BOOL: {
Gtk::CheckButton *check = NULL;
builder->get_widget (glade_name, check);
if (!check)
std::cerr << "Missing boolean config item " << glade_name << "\n";
else
check->set_active (*PTR_BOOL(this, i));
break;
}
case T_INT:
case T_FLOAT: {
Gtk::Widget *w = NULL;
builder->get_widget (glade_name, w);
if (!w) {
std::cerr << "Missing user interface item " << glade_name << "\n";
break;
}
Gtk::SpinButton *spin = dynamic_cast<Gtk::SpinButton *>(w);
if (spin) {
if (settings[i].type == T_INT)
spin->set_value (*PTR_INT(this, i));
else
spin->set_value (*PTR_FLOAT(this, i));
break;
}
Gtk::Range *range = dynamic_cast<Gtk::Range *>(w);
if (range) {
if (settings[i].type == T_INT)
range->set_value (*PTR_INT(this, i));
else
range->set_value (*PTR_FLOAT(this, i));
}
break;
}
case T_STRING: {
Gtk::Entry *e = NULL;
builder->get_widget (glade_name, e);
if (!e) {
std::cerr << "Missing user interface item " << glade_name << "\n";
break;
}
e->set_text(*PTR_STRING(this, i));
break;
}
case T_COLOUR_MEMBER:
break; // Ignore, Colour members are special
default:
std::cerr << "corrupt setting type\n";
break;
}
}
开发者ID:Tyndi,项目名称:3dprint,代码行数:60,代码来源:settings.cpp
示例13: sp_attribute_table_object_modified
static void sp_attribute_table_object_modified ( SPObject */*object*/,
guint flags,
SPAttributeTable *spat )
{
if (flags && SP_OBJECT_MODIFIED_FLAG)
{
std::vector<Glib::ustring> attributes = spat->get_attributes();
std::vector<Gtk::Entry *> entries = spat->get_entries();
Glib::ustring text="";
for (guint i = 0; i < (attributes.size()); i++) {
Gtk::Entry* e = entries[i];
const gchar *val = spat->_object->getRepr()->attribute(attributes[i].c_str());
text = e->get_text ();
if (val || !text.empty()) {
if (text != val) {
/* We are different */
spat->blocked = true;
e->set_text (val ? val : (const gchar *) "");
spat->blocked = false;
}
}
}
}
} // end of sp_attribute_table_object_modified()
开发者ID:Spin0za,项目名称:inkscape,代码行数:25,代码来源:sp-attribute-widget.cpp
示例14: on_zoom_entry_activated
void Widget_Preview::on_zoom_entry_activated()
{
Gtk::Entry* entry = zoom_preview.get_entry();
String str(entry->get_text());
string digi = "0123456789";
size_t first = str.find_first_of(digi);
if (first == string::npos)
{
entry->set_text(_("Fit"));
//release the focus to enable accelerator keys
preview_window.grab_focus();
return ;
}
size_t last = str.find_first_not_of(digi);
if (last == string::npos)
{
last = str.find_last_of(digi) + 1;
}
if (first > last)
{
entry->set_text (_("Fit"));
}
else entry->set_text(str.substr(first, last - first) + "%");
//release the focus to enable accelerator keys
preview_window.grab_focus();
}
开发者ID:berteh,项目名称:synfig,代码行数:34,代码来源:preview.cpp
示例15: showTextEntryDialog
std::string DialogBoxFactory::showTextEntryDialog(Glib::ustring MessageText,
Glib::ustring LabelText)
{
Gtk::Dialog Dialog;
Gtk::Label Message(MessageText);
Gtk::Label Label(LabelText);
Gtk::Entry Entry;
Gtk::HBox Box;
Box.pack_start(Label);
Box.pack_start(Entry);
Dialog.get_vbox()->pack_start(Message, true, true, 10);
Dialog.get_vbox()->pack_start(Box, true, true, 10);
Dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
Dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
Dialog.show_all_children();
if (Dialog.run() == Gtk::RESPONSE_OK)
return Entry.get_text();
return "";
}
开发者ID:VaysseB,项目名称:openfluid,代码行数:26,代码来源:DialogBoxFactory.cpp
示例16: on_limits_changed
void on_limits_changed()
{
magnet::gtk::forceNumericEntry(_minValue);
try { _min = boost::lexical_cast<GLfloat>(_minValue.get_text()); } catch(...) {}
magnet::gtk::forceNumericEntry(_maxValue);
try { _max = boost::lexical_cast<GLfloat>(_maxValue.get_text()); } catch(...) {}
_signal_changed.emit();
}
开发者ID:armando-2011,项目名称:DynamO,代码行数:8,代码来源:colorMapSelector.hpp
示例17: falla
void *procesar_boton(void *nada){ // Hilo que se ejecutará cuando se pulse el botón OK Go!. Simula un inicio de sesión que una vez fallará y otra vez no
Gtk::Label *etiq; // Estos son los objetos que queremos manejar. En la ventana hay más, pero no les hacemos nada, asique no necesitamos declarar punteros a ellos. Esta es la etiqueta que muestra el Cargando...
Gtk::Spinner *spin; // Esto es un dibujito que gira mientras carga
Gtk::Image *image; // Esta es la imagen que aparece cuando se inicia sesión (tanto si falla(muestra una X de error) como si no(muestra un tick verde)
Gtk::RadioButton *radio; // Este es un botón de los de la izquierda, donde seleccionas si inicias sesion, creas usuario o borras usuario
Gtk::Entry *entrada; // Esta es la cajeta de entrada de texto como por ejemplo, donde pones el nombre de usuario y la contraseña
builder->get_widget("label3", etiq); // Como el builder crea la ventana, él nos dará las referencias a los objetos definidos arriba
builder->get_widget("spinner1", spin);
builder->get_widget("image1", image);
image->set_visible(false); // Hacemos que las imagenes no se vean. Mientras está cargando no se muestran. Esta es la imagen de cuando se inicia sesión correctamente
builder->get_widget("image2", image); // Reusamos el puntero para referenciar a la otra imagen. Esta se muestra cuando el inicio sesion falla
image->set_visible(false);
builder->get_widget("radiobutton1",radio);// Como esto se ejecuta cuando se pulsa el botón OK Go!, se supone que estamos procesando el inicio de sesión. Es habitual bloquearlo todo para que no se pueda cambiar de opción mientras se inicia sesion (En realidad es por estética, porque al programa se la trae floja lo que hagas) :)
radio->set_sensitive(false);
builder->get_widget("radiobutton2",radio);
radio->set_sensitive(false);
builder->get_widget("radiobutton3",radio);
radio->set_sensitive(false);
builder->get_widget("entry1", entrada);
entrada->set_sensitive(false);
builder->get_widget("entry2", entrada);
entrada->set_sensitive(false);
spin->set_visible(true); // Como estamos cargando, mostramos el iconito este girando. (Este es el mismo que se muestra cuando buscas archivos en ubuntu)
etiq->set_label("Conectando..."); // Hacemos que la etiqueta muestre Conectando...
sleep(1); // Simulamos que la conexion se establece
etiq->set_label("Obteniendo datos del servidor"); // Se supone que estamos conectados y ahora intercambiamos datos con el servidor
sleep(2); // Simulamos el intercambio de datos
spin->set_visible(false); // Ya se ha procesado el inicio de sesion y ya no debemos ver el iconico girando, porque eso es sólo cuando carga
if(i%2){ // Si es impar, el inicio de sesion es correcto
builder->get_widget("image1", image); // Obtenemos la imagen1, la del tick verde
etiq->set_label("Login correcto"); // Cambiamos el texto de la etiqueta (una etiqueta sólo hace eso: mostrar texto)
} else {
etiq->set_label("Login incorrecto"); // Si es par, el inicio de sesion es incorrecto. No tenemos que obtener la imagen porque el puntero ya apunta a la imagen correcta
}
image->set_visible(true); // Sea cual sea la imagen escogida, se muestra
builder->get_widget("radiobutton1",radio); // Y se desbloquea todo esperando a que el usuario cambie algo y vuelva a pulsar otro botón
radio->set_sensitive(true);
builder->get_widget("radiobutton2",radio);
radio->set_sensitive(true);
builder->get_widget("radiobutton3",radio);
radio->set_sensitive(true);
builder->get_widget("entry1", entrada);
entrada->set_sensitive(true);
builder->get_widget("entry2", entrada);
entrada->set_sensitive(true);
i++; // Esto alterna entre simular un inicio de sesion correcto (i impar) y uno incorrecto (i par)
}
开发者ID:gDanix,项目名称:hello-world,代码行数:57,代码来源:main.cpp
示例18: on_device_name_entry_changed
void GscAddDeviceWindow::on_device_name_entry_changed()
{
// Allow OK only if name is not empty
Gtk::Entry* entry = lookup_widget<Gtk::Entry*>("device_name_entry");
Gtk::Button* ok_button = lookup_widget<Gtk::Button*>("window_ok_button");
if (entry && ok_button) {
ok_button->set_sensitive(!entry->get_text().empty());
}
}
开发者ID:BackupTheBerlios,项目名称:gsmartcontrol-svn,代码行数:9,代码来源:gsc_add_device_window.cpp
示例19: height_changed
void height_changed()
{
Gtk::Entry *entry;
_xml->get_widget("height_entry", entry);
int i= base::atoi<int>(entry->get_text().c_str(), 0);
if (i > 0)
_be.set_height(i);
do_refresh_form_data();
}
开发者ID:abibell,项目名称:mysql-workbench,代码行数:9,代码来源:editor_image_fe.cpp
示例20: update_device_widgets
void GscPreferencesWindow::update_device_widgets(const std::string& device, const std::string& params)
{
Gtk::Entry* entry = 0;
if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_device_entry")))
entry->set_text(device);
if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_parameter_entry")))
entry->set_text(params);
}
开发者ID:BackupTheBerlios,项目名称:gsmartcontrol-svn,代码行数:10,代码来源:gsc_preferences_window.cpp
注:本文中的gtk::Entry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论