static void thunar_text_renderer_grab_focus (GtkWidget *entry, ThunarTextRenderer *text_renderer) { const gchar *text; const gchar *dot; glong offset; /* determine the text from the entry widget */ text = gtk_entry_get_text (GTK_ENTRY (entry)); /* lookup the last dot in the text */ dot = strrchr (text, '.'); if (G_LIKELY (dot != NULL)) { /* determine the UTF-8 char offset */ offset = g_utf8_pointer_to_offset (text, dot); /* select the text prior to the dot */ if (G_LIKELY (offset > 0)) gtk_entry_select_region (GTK_ENTRY (entry), 0, offset); } /* disconnect the grab-focus handler, so we change the selection only once */ g_signal_handlers_disconnect_by_func (G_OBJECT (entry), thunar_text_renderer_grab_focus, text_renderer); }
void fx_head_impre_event_func(GtkWidget* widget , GdkEventButton* event , gpointer data) { FxMain* fxmain = (FxMain*)data; FxHead* fxhead = fxmain->headPanel; GdkColor color; gdk_color_parse ("white", &color); GdkCursor* cursor = NULL; const char* text = NULL; switch(event->type) { case GDK_BUTTON_PRESS : if(fx_conn_check_action(fxmain)){ gtk_widget_show(fxhead->impre_entry); text = gtk_label_get_text(GTK_LABEL(fxhead->impre_label)); gtk_entry_set_text(GTK_ENTRY(fxhead->impre_entry) , text); gtk_entry_select_region(GTK_ENTRY(fxhead->impre_entry) , 0 , strlen(text)); gtk_widget_grab_focus(fxhead->impre_entry); gtk_widget_hide(widget); } break; case GDK_ENTER_NOTIFY : gtk_widget_modify_bg(fxhead->impre_box, GTK_STATE_NORMAL, &color); cursor = gdk_cursor_new (GDK_HAND2); gdk_window_set_cursor(widget->window , cursor); break; case GDK_LEAVE_NOTIFY : gtk_widget_modify_bg(fxhead->impre_box, GTK_STATE_NORMAL, NULL); cursor = gdk_cursor_new (GDK_LEFT_PTR); gdk_window_set_cursor(widget->window , cursor); break; default: break; }; }
void entrybox(char *title, int width, char *default_text, int maxch, GtkSignalFunc func) { GtkWidget *vbox, *hbox; GtkWidget *button1, *button2; cleanup=func; /* create a new modal window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_grab_add(window); gtk_widget_set_usize( GTK_WIDGET (window), width, 60); gtk_window_set_title(GTK_WINDOW (window), title); gtk_signal_connect(GTK_OBJECT (window), "delete_event", (GtkSignalFunc) destroy_callback, NULL); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); entry = gtk_entry_new_with_max_length (maxch); gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(enter_callback), entry); gtk_entry_set_text (GTK_ENTRY (entry), default_text); gtk_entry_select_region (GTK_ENTRY (entry), 0, GTK_ENTRY(entry)->text_length); gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); hbox = gtk_hbox_new (FALSE, 1); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button1 = gtk_button_new_with_label ("OK"); gtk_widget_set_usize(button1, 100, -1); gtk_signal_connect(GTK_OBJECT (button1), "clicked", GTK_SIGNAL_FUNC(enter_callback), NULL); gtk_widget_show (button1); gtk_container_add (GTK_CONTAINER (hbox), button1); GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); gtk_signal_connect_object (GTK_OBJECT (button1), "realize", (GtkSignalFunc) gtk_widget_grab_default, GTK_OBJECT (button1)); button2 = gtk_button_new_with_label ("Cancel"); gtk_widget_set_usize(button2, 100, -1); gtk_signal_connect(GTK_OBJECT (button2), "clicked", GTK_SIGNAL_FUNC(destroy_callback), NULL); GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); gtk_widget_show (button2); gtk_container_add (GTK_CONTAINER (hbox), button2); gtk_widget_show(window); }
static void enter_callback(GtkWidget *widget, gpointer which) { (void)widget; GtkWidget *entry; /* TimeType *modify; */ /* scan-build */ TimeType temp; G_CONST_RETURN gchar *entry_text; char buf[49]; int i; int ent_idx; uint32_t hashmask = WAVE_NUM_NAMED_MARKERS; hashmask |= hashmask >> 1; hashmask |= hashmask >> 2; hashmask |= hashmask >> 4; hashmask |= hashmask >> 8; hashmask |= hashmask >> 16; ent_idx = ((int) (((intptr_t) which) & hashmask)) % WAVE_NUM_NAMED_MARKERS; entry=GLOBALS->entries_markerbox_c_1[ent_idx]; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); entry_text = entry_text ? entry_text : ""; if(!strlen(entry_text)) goto failure; temp=unformat_time(entry_text, GLOBALS->time_dimension); temp -= GLOBALS->global_time_offset; if((temp<GLOBALS->tims.start)||(temp>GLOBALS->tims.last)) goto failure; for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++) { if(temp==GLOBALS->shadow_markers_markerbox_c_1[i]) goto failure; } reformat_time_simple(buf, temp + GLOBALS->global_time_offset, GLOBALS->time_dimension); gtk_entry_set_text (GTK_ENTRY (entry), buf); GLOBALS->shadow_markers_markerbox_c_1[ent_idx]=temp; GLOBALS->dirty_markerbox_c_1=1; gtk_entry_select_region (GTK_ENTRY (entry), 0, GTK_ENTRY(entry)->text_length); return; failure: /* modify=(TimeType *)which; */ /* scan-build */ if(GLOBALS->shadow_markers_markerbox_c_1[ent_idx]==-1) { sprintf(buf,"<None>"); } else { reformat_time_simple(buf, GLOBALS->shadow_markers_markerbox_c_1[ent_idx] + GLOBALS->global_time_offset, GLOBALS->time_dimension); } gtk_entry_set_text (GTK_ENTRY (entry), buf); }
void select_minilist_item(GtkWidget * list, gint row, gint column, GdkEventButton * event, gpointer data) { struct slist_gui *the_gui = (struct slist_gui *) data; gchar *to_change; the_gui->chosen_row = row; gtk_clist_get_text(GTK_CLIST(the_gui->list), row, 0, &to_change); gtk_entry_set_text(GTK_ENTRY(the_gui->entry), to_change); gtk_entry_select_region(GTK_ENTRY(the_gui->entry), 0, -1); }
void voditel_get(GtkWidget *widget,class lzaktaxiv_data *v_data) { char bros[300]; char strsql[300]; SQL_str row; char kod[100]; //printf("voditel_get\n"); strcpy(kod,iceb_u_fromutf((char*)gtk_entry_get_text(GTK_ENTRY(widget)))); v_data->zap_zaktaxi.kv.new_plus(kod); if(v_data->zap_zaktaxi.kv.getdlinna() <= 1) return; if(kod[0] == '\0') return; memset(bros,'\0',sizeof(bros)); if(iceb_u_polen(kod,bros,sizeof(bros),1,' ') != 0) strncpy(bros,kod,sizeof(bros)-1); sprintf(strsql,"select fio,gosn,sm from Taxivod where kod='%s'",bros); //printf("%s\n",strsql); SQLCURSOR cur; if(sql_readkey(&bd,strsql,&row,&cur) != 1) { iceb_u_str repl; sprintf(strsql,"Нет водителя с кодом %s !!!",bros); repl.plus(strsql); iceb_menu_soob(&repl,NULL); return; } sprintf(kod,"%s %s %s",bros,row[0],row[1]); if(atoi(row[2]) != 0) { iceb_u_str repl; repl.plus("Этого водителя нет на смене !!!"); repl.ps_plus(kod); iceb_menu_soob(&repl,NULL); gtk_entry_set_text(GTK_ENTRY(widget),""); return; } gtk_entry_set_text(GTK_ENTRY(widget),iceb_u_toutf(kod)); gtk_entry_select_region(GTK_ENTRY(widget),0,strlen(kod)); }
void kodzav_get1(GtkWidget *widget,class lzaktaxi_data *data) { char bros[300]; char strsql[300]; SQL_str row; SQLCURSOR cur; char kod[100]; //printf("kodzav_get**********************************\n"); strcpy(kod,iceb_u_fromutf((char*)gtk_entry_get_text(GTK_ENTRY(widget)))); data->kod_zav.new_plus(kod); if(data->kod_zav.getdlinna() <= 1) return; if(data->metkapvk == 1) return; if(kod[0] == '\0') return; memset(bros,'\0',sizeof(bros)); if(iceb_u_polen(kod,bros,sizeof(bros),1,' ') != 0) strncpy(bros,kod,sizeof(bros)-1); sprintf(strsql,"select naik from Taxikzz where kod=%s",bros); //printf("%s\n",strsql); if(sql_readkey(&bd,strsql,&row,&cur) != 1) { iceb_u_str repl; sprintf(strsql,"Нет такого кода завершения !!!"); repl.plus(strsql); iceb_menu_soob(&repl,NULL); return; } sprintf(kod,"%s %s",bros,row[0]); gtk_entry_set_text(GTK_ENTRY(widget),iceb_u_toutf(kod)); gtk_entry_select_region(GTK_ENTRY(widget),0,strlen(kod)); }
static void input_dialog_set(const gchar *title, const gchar *message, const gchar *default_string) { GtkWidget *entry_; if (type == INPUT_DIALOG_COMBO) entry_ = GTK_COMBO(combo)->entry; else entry_ = entry; gtk_window_set_title(GTK_WINDOW(dialog), title); gtk_label_set_text(GTK_LABEL(msg_label), message); if (default_string && *default_string) { gtk_entry_set_text(GTK_ENTRY(entry_), default_string); gtk_entry_set_position(GTK_ENTRY(entry_), 0); gtk_entry_select_region(GTK_ENTRY(entry_), 0, -1); } else gtk_entry_set_text(GTK_ENTRY(entry_), ""); gtk_widget_grab_focus(ok_button); gtk_widget_grab_focus(entry_); }
static void str_enter_callback(GtkWidget *entry, gpointer which) { G_CONST_RETURN gchar *entry_text; int i; uint32_t hashmask = WAVE_NUM_NAMED_MARKERS; hashmask |= hashmask >> 1; hashmask |= hashmask >> 2; hashmask |= hashmask >> 4; hashmask |= hashmask >> 8; hashmask |= hashmask >> 16; i = ((int) (((intptr_t) which) & hashmask)) % WAVE_NUM_NAMED_MARKERS; GLOBALS->dirty_markerbox_c_1 = 1; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); if(entry_text && strlen(entry_text)) { if(GLOBALS->shadow_marker_names[i]) { free_2(GLOBALS->shadow_marker_names[i]); } GLOBALS->shadow_marker_names[i] = strdup_2(entry_text); gtk_entry_select_region (GTK_ENTRY (entry), 0, GTK_ENTRY(entry)->text_length); } else { if(GLOBALS->shadow_marker_names[i]) { free_2(GLOBALS->shadow_marker_names[i]); GLOBALS->shadow_marker_names[i] = NULL; } } }
static gboolean dialog_set_offset(int chan_num) { scope_vert_t *vert; scope_chan_t *chan; dialog_generic_t dialog; gchar *title, msg[BUFLEN], *cptr; struct offset_data data; GtkWidget *label, *button; double tmp; vert = &(ctrl_usr->vert); chan = &(ctrl_usr->chan[chan_num - 1]); title = _("Set Offset"); snprintf(msg, BUFLEN - 1, _("Set the vertical offset\n" "for channel %d."), chan_num); /* create dialog window, disable resizing */ dialog.retval = 0; dialog.window = gtk_dialog_new(); dialog.app_data = &data; /* allow user to grow but not shrink the window */ gtk_window_set_policy(GTK_WINDOW(dialog.window), FALSE, TRUE, FALSE); /* window should appear in center of screen */ gtk_window_set_position(GTK_WINDOW(dialog.window), GTK_WIN_POS_CENTER); /* set title */ gtk_window_set_title(GTK_WINDOW(dialog.window), title); /* display message */ label = gtk_label_new(msg); gtk_misc_set_padding(GTK_MISC(label), 15, 5); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog.window)->vbox), label, FALSE, TRUE, 0); /* a separator */ gtk_hseparator_new_in_box(GTK_DIALOG(dialog.window)->vbox, 0); /* a checkbox: AC coupled */ vert->offset_ac = gtk_check_button_new_with_label(_("AC Coupled")); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog.window)->vbox), vert->offset_ac, FALSE, TRUE, 0); /* react to changes to the checkbox */ gtk_signal_connect(GTK_OBJECT(vert->offset_ac), "toggled", GTK_SIGNAL_FUNC(offset_changed), &data); /* the entry */ vert->offset_entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog.window)->vbox), vert->offset_entry, FALSE, TRUE, 0); snprintf(data.buf, BUFLEN, "%f", chan->vert_offset); gtk_entry_set_text(GTK_ENTRY(vert->offset_entry), data.buf); gtk_entry_set_max_length(GTK_ENTRY(vert->offset_entry), BUFLEN-1); /* point at first char */ gtk_entry_set_position(GTK_ENTRY(vert->offset_entry), 0); /* select all chars, so if the user types the original value goes away */ gtk_entry_select_region(GTK_ENTRY(vert->offset_entry), 0, strlen(data.buf)); /* make it active so user doesn't have to click on it */ gtk_widget_grab_focus(GTK_WIDGET(vert->offset_entry)); gtk_widget_show(vert->offset_entry); /* capture entry data to the buffer whenever the user types */ gtk_signal_connect(GTK_OBJECT(vert->offset_entry), "changed", GTK_SIGNAL_FUNC(offset_changed), data.buf); /* set up a callback function when the window is destroyed */ gtk_signal_connect(GTK_OBJECT(dialog.window), "destroy", GTK_SIGNAL_FUNC(dialog_generic_destroyed), &dialog); /* make OK and Cancel buttons */ button = gtk_button_new_with_label(_("OK")); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog.window)->action_area), button, TRUE, TRUE, 4); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dialog_generic_button1), &dialog); /* hit the "OK" button if the user hits enter */ gtk_signal_connect(GTK_OBJECT(vert->offset_entry), "activate", GTK_SIGNAL_FUNC(offset_activated), button); button = gtk_button_new_with_label(_("Cancel")); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog.window)->action_area), button, TRUE, TRUE, 4); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dialog_generic_button2), &dialog); /* make window transient and modal */ gtk_window_set_transient_for(GTK_WINDOW(dialog.window), GTK_WINDOW(ctrl_usr->main_win)); gtk_window_set_modal(GTK_WINDOW(dialog.window), TRUE); gtk_widget_show_all(dialog.window); gtk_main(); /* we get here when the user makes a selection, hits Cancel, or closes the window */ if ((dialog.retval == 0) || (dialog.retval == 2)) { /* user either closed dialog, or hit cancel */ return FALSE; } tmp = strtod(data.buf, &cptr); if (cptr == data.buf) { return FALSE; } set_vert_offset(tmp, data.ac_coupled); return TRUE; }
void Internet (void) { if ((ifilestuff == 0) && ((biscomputer == 0) || (wiscomputer == 0)) && (iyesno == 0) && (inet == 0)) { connectwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (connectwindow), "Internet play"); gtk_signal_connect (GTK_OBJECT (connectwindow), "delete_event", GTK_SIGNAL_FUNC (DestroyConnect), NULL); gtk_window_set_policy (GTK_WINDOW (connectwindow), 0, 0, 1); gtk_container_border_width (GTK_CONTAINER (connectwindow), 0); gtk_widget_realize (connectwindow); connectbox1 = gtk_vbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (connectbox1), 0); gtk_container_add (GTK_CONTAINER (connectwindow), connectbox1); gtk_widget_show (connectbox1); connectbox2 = gtk_hbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (connectbox2), 0); gtk_box_pack_start (GTK_BOX (connectbox1), connectbox2, FALSE, FALSE, 0); gtk_widget_show (connectbox2); connecttable1 = gtk_table_new (2, 4, FALSE); gtk_box_pack_start (GTK_BOX (connectbox2), connecttable1, TRUE, TRUE, 0); gtk_widget_show (connecttable1); entrylabel1 = gtk_label_new ("host:"); gtk_label_set (GTK_LABEL (entrylabel1), "host:"); gtk_label_set_justify (GTK_LABEL (entrylabel1), GTK_JUSTIFY_CENTER); gtk_table_attach (GTK_TABLE (connecttable1), entrylabel1, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 10, 10); gtk_widget_show (entrylabel1); connectentry1 = gtk_entry_new_with_max_length (50); gtk_entry_set_text (GTK_ENTRY (connectentry1), "nngs.cosmic.org"); gtk_entry_select_region (GTK_ENTRY (connectentry1), 0, GTK_ENTRY (connectentry1)->text_length); gtk_table_attach (GTK_TABLE (connecttable1), connectentry1, 1, 2, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 10); gtk_widget_grab_focus (connectentry1); gtk_widget_show (connectentry1); entrylabel2 = gtk_label_new ("port:"); gtk_label_set (GTK_LABEL (entrylabel2), "port:"); gtk_label_set_justify (GTK_LABEL (entrylabel2), GTK_JUSTIFY_CENTER); gtk_table_attach (GTK_TABLE (connecttable1), entrylabel2, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 10, 10); gtk_widget_show (entrylabel2); connectentry2 = gtk_entry_new_with_max_length (5); gtk_entry_set_text (GTK_ENTRY (connectentry2), "9696"); gtk_table_attach (GTK_TABLE (connecttable1), connectentry2, 1, 2, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 10); gtk_widget_show (connectentry2); connectsep = gtk_hseparator_new (); gtk_table_attach (GTK_TABLE (connecttable1), connectsep, 0, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (connectsep); connectbutton = gtk_button_new_with_label ("Connect"); gtk_signal_connect (GTK_OBJECT (connectbutton), "clicked", GTK_SIGNAL_FUNC (InternetGo), NULL); GTK_WIDGET_SET_FLAGS (connectbutton, GTK_CAN_DEFAULT); gtk_window_set_default (GTK_WINDOW (connectwindow), connectbutton); gtk_table_attach (GTK_TABLE (connecttable1), connectbutton, 0, 2, 3, 4, GTK_FILL, GTK_FILL, 2, 2); gtk_widget_show (connectbutton); gtk_widget_show (connectwindow); iyesno = 1; } }
void entrybox(char *title, int width, char *dflt_text, char *comment, int maxch, GtkSignalFunc func) { #ifndef WAVE_MAC_USE_ENTRY GtkWidget *vbox, *hbox; GtkWidget *button1, *button2; int height = (comment) ? 75 : 60; #endif GLOBALS->cleanup_entry_c_1=func; /* fix problem where ungrab doesn't occur if button pressed + simultaneous accelerator key occurs */ if(GLOBALS->in_button_press_wavewindow_c_1) { gdk_pointer_ungrab(GDK_CURRENT_TIME); } if(GLOBALS->wave_script_args) { char *s = NULL; while((!s)&&(GLOBALS->wave_script_args->curr)) s = wave_script_args_fgetmalloc_stripspaces(GLOBALS->wave_script_args); if(s) { fprintf(stderr, "GTKWAVE | Entry '%s'\n", s); GLOBALS->entrybox_text = s; GLOBALS->cleanup_entry_c_1(); } else { GLOBALS->entrybox_text = NULL; } return; } #ifdef WAVE_MAC_USE_ENTRY { char *out_text_entry = NULL; entrybox_req_bridge(title, width, dflt_text, comment, maxch, &out_text_entry); if(out_text_entry) { int len=strlen(out_text_entry); if(!len) GLOBALS->entrybox_text=NULL; else strcpy((GLOBALS->entrybox_text=(char *)malloc_2(len+1)),out_text_entry); free(out_text_entry); GLOBALS->cleanup_entry_c_1(); } else { GLOBALS->entrybox_text = NULL; } return; } #else /* create a new modal window */ GLOBALS->window_entry_c_1 = gtk_window_new(GLOBALS->disable_window_manager ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL); install_focus_cb(GLOBALS->window_entry_c_1, ((char *)&GLOBALS->window_entry_c_1) - ((char *)GLOBALS)); gtk_widget_set_usize( GTK_WIDGET (GLOBALS->window_entry_c_1), width, height); gtk_window_set_title(GTK_WINDOW (GLOBALS->window_entry_c_1), title); gtkwave_signal_connect(GTK_OBJECT (GLOBALS->window_entry_c_1), "delete_event",(GtkSignalFunc) destroy_callback, NULL); gtk_window_set_policy(GTK_WINDOW(GLOBALS->window_entry_c_1), FALSE, FALSE, FALSE); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (GLOBALS->window_entry_c_1), vbox); gtk_widget_show (vbox); if (comment) { GtkWidget *label, *cbox; cbox = gtk_hbox_new (FALSE, 1); gtk_box_pack_start (GTK_BOX (vbox), cbox, FALSE, FALSE, 0); gtk_widget_show (cbox); label = gtk_label_new(comment); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (cbox), label); GTK_WIDGET_SET_FLAGS (label, GTK_CAN_DEFAULT); } GLOBALS->entry_entry_c_1 = gtk_entry_new_with_max_length (maxch); gtkwave_signal_connect(GTK_OBJECT(GLOBALS->entry_entry_c_1), "activate",GTK_SIGNAL_FUNC(enter_callback),GLOBALS->entry_entry_c_1); gtk_entry_set_text (GTK_ENTRY (GLOBALS->entry_entry_c_1), dflt_text); gtk_entry_select_region (GTK_ENTRY (GLOBALS->entry_entry_c_1),0, GTK_ENTRY(GLOBALS->entry_entry_c_1)->text_length); gtk_box_pack_start (GTK_BOX (vbox), GLOBALS->entry_entry_c_1, FALSE, FALSE, 0); gtk_widget_show (GLOBALS->entry_entry_c_1); hbox = gtk_hbox_new (FALSE, 1); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button1 = gtk_button_new_with_label ("OK"); gtk_widget_set_usize(button1, 100, -1); gtkwave_signal_connect(GTK_OBJECT (button1), "clicked", GTK_SIGNAL_FUNC(enter_callback), NULL); gtk_widget_show (button1); gtk_container_add (GTK_CONTAINER (hbox), button1); GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); gtkwave_signal_connect_object (GTK_OBJECT (button1), "realize", (GtkSignalFunc) gtk_widget_grab_default, GTK_OBJECT (button1)); button2 = gtk_button_new_with_label ("Cancel"); gtk_widget_set_usize(button2, 100, -1); gtkwave_signal_connect(GTK_OBJECT (button2), "clicked", GTK_SIGNAL_FUNC(destroy_callback), NULL); GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); gtk_widget_show (button2); gtk_container_add (GTK_CONTAINER (hbox), button2); gtk_widget_show(GLOBALS->window_entry_c_1); wave_gtk_grab_add(GLOBALS->window_entry_c_1); gdk_window_raise(GLOBALS->window_entry_c_1->window); gtk_signal_connect(GTK_OBJECT(GLOBALS->window_entry_c_1), "key_press_event",GTK_SIGNAL_FUNC(keypress_local), NULL); #endif }
void CallBuiltinLibSelectionWindow (PtrBalsaFile file, PtrBuiltinLib editedTest) { GtkWidget *dialogue = create_BuiltinLibOptionsDialogue (); GtkEntry *nameEntry = GTK_ENTRY (gtk_object_get_data (GTK_OBJECT (dialogue), "NameEntry")); GtkEntry *compileOptionsEntry = GTK_ENTRY (gtk_object_get_data (GTK_OBJECT (dialogue), "CompileOptionsEntry")); GtkList *sourceList = GTK_LIST (gtk_object_get_data (GTK_OBJECT (dialogue), "SourceList")); if (editedTest) { gtk_entry_set_text (nameEntry, g_strdup (editedTest->name)); gtk_entry_set_text (GTK_ENTRY (compileOptionsEntry), editedTest->compileOptions); GList *items = MakeListItemListFromStringList (editedTest->sourceFilenames); gtk_list_append_items (sourceList, items); } else { // find a unused name for the test char *test_name = NULL; int num = 1; test_name = g_strdup (file->name); goto jump1; retry: g_free (test_name); test_name = g_strdup_printf ("lib%d", num); jump1: { // Check the test name doesn't already exist GList *files; for (files = CurrentBalsaProject->files; files; files = files->next) { PtrBalsaFile file = (PtrBalsaFile) files->data; GList *tests = file->info.balsaFile.testFixtures; for (; tests; tests = tests->next) { PtrBalsaTest test = (PtrBalsaTest) tests->data; if (!strcmp (test_name, test->name)) { num++; goto retry; } } } } gtk_entry_set_text (nameEntry, test_name); } gtk_entry_select_region (nameEntry, 0, -1); gtk_widget_grab_focus (GTK_WIDGET (nameEntry)); gtk_object_set_data (GTK_OBJECT (dialogue), "BalsaFile", file); gtk_object_set_data (GTK_OBJECT (dialogue), "EditedTest", editedTest); gtk_widget_show (dialogue); }
/* * mainline.. */ void searchbox(char *title, GtkSignalFunc func) { int i; GtkWidget *menu, *menuitem, *optionmenu; GSList *group; GtkWidget *small_hbox; GtkWidget *scrolled_win; GtkWidget *vbox1, *hbox, *hbox0; GtkWidget *button1, *button2, *button3, *button3a, *button4, *button5, *button6, *button7; GtkWidget *label; gchar *titles[]={"Matches"}; GtkWidget *frame1, *frame2, *frameh, *frameh0; GtkWidget *table; GtkTooltips *tooltips; GtkAdjustment *adj; GtkWidget *align; if(is_active) { gdk_window_raise(window->window); return; } is_active=1; cleanup=func; num_rows=selected_rows=0; /* create a new modal window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW (window), title); gtk_signal_connect(GTK_OBJECT (window), "delete_event", (GtkSignalFunc) destroy_callback, NULL); tooltips=gtk_tooltips_new_2(); table = gtk_table_new (256, 1, FALSE); gtk_widget_show (table); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (vbox1), 3); gtk_widget_show (vbox1); frame1 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frame1), 3); gtk_widget_show(frame1); gtk_table_attach (GTK_TABLE (table), frame1, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); label=gtk_label_new("Signal Search Expression"); gtk_widget_show(label); gtk_box_pack_start (GTK_BOX (vbox1), label, TRUE, TRUE, 0); entry = gtk_entry_new_with_max_length (256); gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(enter_callback), entry); gtk_entry_set_text (GTK_ENTRY (entry), searchbox_text); gtk_entry_select_region (GTK_ENTRY (entry), 0, GTK_ENTRY(entry)->text_length); gtk_widget_show (entry); gtk_tooltips_set_tip_2(tooltips, entry, "Enter search expression here. POSIX Wildcards are allowed. Note that you may also " "modify the search criteria by selecting ``[W]Range'', ``[W]Strand'', or ``None'' for suffix " "matching.",NULL); gtk_box_pack_start (GTK_BOX (vbox1), entry, TRUE, TRUE, 0); /* Allocate memory for the data that is used later */ pdata = calloc_2(1, sizeof(SearchProgressData) ); pdata->value = pdata->oldvalue = 0.0; /* Create a centering alignment object */ align = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show(align); /* Create a Adjustment object to hold the range of the * progress bar */ adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, (gfloat)((numfacs>1)?numfacs-1:1), 0, 0, 0); pdata->adj = adj; /* Create the GtkProgressBar using the adjustment */ pdata->pbar = gtk_progress_bar_new_with_adjustment (adj); /* Set the format of the string that can be displayed in the * trough of the progress bar: * %p - percentage * %v - value * %l - lower range value * %u - upper range value */ gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar), "(%p%%)"); gtk_progress_set_show_text (GTK_PROGRESS (pdata->pbar), TRUE); gtk_widget_show(pdata->pbar); gtk_box_pack_start (GTK_BOX (vbox1), pdata->pbar, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (frame1), vbox1); frame2 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frame2), 3); gtk_widget_show(frame2); gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 1, 254, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); clist=gtk_clist_new_with_titles(1,titles); gtk_clist_column_titles_passive(GTK_CLIST(clist)); gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED); gtk_signal_connect_object (GTK_OBJECT (clist), "select_row", GTK_SIGNAL_FUNC(select_row_callback), NULL); gtk_signal_connect_object (GTK_OBJECT (clist), "unselect_row", GTK_SIGNAL_FUNC(unselect_row_callback), NULL); gtk_widget_show (clist); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300); gtk_widget_show(scrolled_win); /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */ gtk_container_add (GTK_CONTAINER (scrolled_win), clist); gtk_container_add (GTK_CONTAINER (frame2), scrolled_win); frameh0 = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frameh0), 3); gtk_widget_show(frameh0); gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); hbox0 = gtk_hbox_new (FALSE, 1); gtk_widget_show (hbox0); button6 = gtk_button_new_with_label (" Select All "); gtk_container_border_width (GTK_CONTAINER (button6), 3); gtk_signal_connect_object (GTK_OBJECT (button6), "clicked", GTK_SIGNAL_FUNC(select_all_callback), GTK_OBJECT (window)); gtk_widget_show (button6); gtk_tooltips_set_tip_2(tooltips, button6, "Highlight all signals listed in the match window.",NULL); gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0); menu = gtk_menu_new (); group=NULL; small_hbox = gtk_hbox_new (TRUE, 0); gtk_widget_show (small_hbox); for(i=0;i<5;i++) { menuitem = gtk_radio_menu_item_new_with_label (group, regex_name[i]); group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem)); gtk_menu_append (GTK_MENU (menu), menuitem); gtk_widget_show (menuitem); gtk_signal_connect(GTK_OBJECT (menuitem), "activate", GTK_SIGNAL_FUNC(regex_clicked), ®ex_mutex[i]); regex_mutex[i]=0; } regex_mutex[0]=1; /* "range" */ optionmenu = gtk_option_menu_new (); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu); gtk_box_pack_start (GTK_BOX (small_hbox), optionmenu, TRUE, FALSE, 0); gtk_widget_show (optionmenu); gtk_tooltips_set_tip_2(tooltips, optionmenu, "You may " "modify the search criteria by selecting ``Range'', ``Strand'', or ``None'' for suffix " "matching. This optionally matches the string you enter in the search string above with a Verilog " "format range (signal[7:0]), a strand (signal.1, signal.0), or with no suffix. " "The ``W'' modifier for ``Range'' and ``Strand'' explicitly matches on word boundaries. " "(addr matches unit.freezeaddr[63:0] for ``Range'' but only unit.addr[63:0] for ``WRange'' since addr has to be on a word boundary. " "Note that when ``None'' " "is selected, the search string may be located anywhere in the signal name.",NULL); gtk_box_pack_start (GTK_BOX (hbox0), small_hbox, FALSE, FALSE, 0); button7 = gtk_button_new_with_label (" Unselect All "); gtk_container_border_width (GTK_CONTAINER (button7), 3); gtk_signal_connect_object (GTK_OBJECT (button7), "clicked", GTK_SIGNAL_FUNC(unselect_all_callback), GTK_OBJECT (window)); gtk_widget_show (button7); gtk_tooltips_set_tip_2(tooltips, button7, "Unhighlight all signals listed in the match window.",NULL); gtk_box_pack_start (GTK_BOX (hbox0), button7, TRUE, FALSE, 0); gtk_container_add (GTK_CONTAINER (frameh0), hbox0); frameh = gtk_frame_new (NULL); gtk_container_border_width (GTK_CONTAINER (frameh), 3); gtk_widget_show(frameh); gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1); hbox = gtk_hbox_new (FALSE, 1); gtk_widget_show (hbox); button1 = gtk_button_new_with_label ("Append"); gtk_container_border_width (GTK_CONTAINER (button1), 3); gtk_signal_connect_object (GTK_OBJECT (button1), "clicked", GTK_SIGNAL_FUNC(ok_callback), GTK_OBJECT (window)); gtk_widget_show (button1); gtk_tooltips_set_tip_2(tooltips, button1, "Add selected signals to end of the display on the main window.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0); button2 = gtk_button_new_with_label (" Insert "); gtk_container_border_width (GTK_CONTAINER (button2), 3); gtk_signal_connect_object (GTK_OBJECT (button2), "clicked", GTK_SIGNAL_FUNC(insert_callback), GTK_OBJECT (window)); gtk_widget_show (button2); gtk_tooltips_set_tip_2(tooltips, button2, "Add selected signals after last highlighted signal on the main window.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button2, TRUE, FALSE, 0); if(vcd_explicit_zero_subscripts>=0) { button3 = gtk_button_new_with_label (" Bundle Up "); gtk_container_border_width (GTK_CONTAINER (button3), 3); gtk_signal_connect_object (GTK_OBJECT (button3), "clicked", GTK_SIGNAL_FUNC(bundle_callback_up), GTK_OBJECT (window)); gtk_widget_show (button3); gtk_tooltips_set_tip_2(tooltips, button3, "Bundle selected signals into a single bit vector with the topmost selected signal as the LSB and the lowest as the MSB.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button3, TRUE, FALSE, 0); button3a = gtk_button_new_with_label (" Bundle Down "); gtk_container_border_width (GTK_CONTAINER (button3a), 3); gtk_signal_connect_object (GTK_OBJECT (button3a), "clicked", GTK_SIGNAL_FUNC(bundle_callback_down), GTK_OBJECT (window)); gtk_widget_show (button3a); gtk_tooltips_set_tip_2(tooltips, button3a, "Bundle selected signals into a single bit vector with the topmost selected signal as the MSB and the lowest as the LSB.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button3a, TRUE, FALSE, 0); } button4 = gtk_button_new_with_label (" Replace "); gtk_container_border_width (GTK_CONTAINER (button4), 3); gtk_signal_connect_object (GTK_OBJECT (button4), "clicked", GTK_SIGNAL_FUNC(replace_callback), GTK_OBJECT (window)); gtk_widget_show (button4); gtk_tooltips_set_tip_2(tooltips, button4, "Replace highlighted signals on the main window with signals selected above.",NULL); gtk_box_pack_start (GTK_BOX (hbox), button4, TRUE, FALSE, 0); button5 = gtk_button_new_with_label (" Exit "); gtk_container_border_width (GTK_CONTAINER (button5), 3); gtk_signal_connect_object (GTK_OBJECT (button5), "clicked", GTK_SIGNAL_FUNC(destroy_callback), GTK_OBJECT (window)); gtk_tooltips_set_tip_2(tooltips, button5, "Do nothing and return to the main window.",NULL); gtk_widget_show (button5); gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0); gtk_container_add (GTK_CONTAINER (frameh), hbox); gtk_container_add (GTK_CONTAINER (window), table); gtk_widget_show(window); if(strlen(searchbox_text)) enter_callback(entry,NULL); }
void kodkl_get(GtkWidget *widget,class lzaktaxiv_data *v_data) { char kod[300]; char strsql[300]; SQL_str row; //printf("kodkl_get\n"); strcpy(kod,iceb_u_fromutf((char*)gtk_entry_get_text(GTK_ENTRY(widget)))); v_data->zap_zaktaxi.kodk.new_plus(kod); if(v_data->zap_zaktaxi.kodk.getdlinna() <= 1) return; sprintf(strsql,"select fio,adres,telef from Taxiklient where kod='%s'",kod); //printf("%s\n",strsql); SQLCURSOR cur; if(sql_readkey(&bd,strsql,&row,&cur) != 1) { iceb_u_str repl; sprintf(strsql,"Нет клиента с кодом %s !!!",kod); repl.plus(strsql); iceb_menu_soob(&repl,NULL); return; } v_data->zap_zaktaxi.fio.new_plus(row[0]); v_data->zap_zaktaxi.adreso.new_plus(iceb_u_fromutf((char*)gtk_entry_get_text(GTK_ENTRY(v_data->entry[E_ADRES_POD])))); if(v_data->zap_zaktaxi.adreso.getdlinna() <= 1) v_data->zap_zaktaxi.adreso.new_plus(row[1]); v_data->zap_zaktaxi.telef.new_plus(iceb_u_fromutf((char*)gtk_entry_get_text(GTK_ENTRY(v_data->entry[E_TELEF])))); if(v_data->zap_zaktaxi.telef.getdlinna() <= 1) v_data->zap_zaktaxi.telef.new_plus(row[2]); iceb_u_str stroka; stroka.plus(iceb_u_toutf(v_data->zap_zaktaxi.fio.ravno())); gtk_entry_set_text(GTK_ENTRY(v_data->entry[E_FIO]),stroka.ravno()); stroka.new_plus(iceb_u_toutf(v_data->zap_zaktaxi.adreso.ravno())); gtk_entry_set_text(GTK_ENTRY(v_data->entry[E_ADRES_POD]),stroka.ravno()); stroka.new_plus(iceb_u_toutf(v_data->zap_zaktaxi.telef.ravno())); gtk_entry_set_text(GTK_ENTRY(v_data->entry[E_TELEF]),stroka.ravno()); double suma=taxi_saldo(v_data->zap_zaktaxi.kodk.ravno()); char bros[50]; sprintf(bros,"Сальдо: %.2f ",suma); stroka.new_plus(iceb_u_toutf(bros)); gtk_label_set_text(GTK_LABEL(v_data->label_saldo),stroka.ravno()); gtk_entry_select_region(GTK_ENTRY(widget),0,strlen(kod)); }
void Human (GtkWidget *humwidget, gpointer humdata) { if ((ifilestuff == 0) && ((biscomputer == 0) || (wiscomputer == 0)) && (iyesno == 0)) { ichangecolorh = (int) humdata; humwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); if (ichangecolorh == 1) { gtk_window_set_title (GTK_WINDOW (humwindow), "change white"); } else { gtk_window_set_title (GTK_WINDOW (humwindow), "change black"); } gtk_signal_connect (GTK_OBJECT (humwindow), "delete_event", GTK_SIGNAL_FUNC (DestroyHuman), NULL); gtk_window_set_policy (GTK_WINDOW (humwindow), 0, 0, 1); gtk_container_border_width (GTK_CONTAINER (humwindow), 0); gtk_widget_realize (humwindow); humbox1 = gtk_vbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (humbox1), 0); gtk_container_add (GTK_CONTAINER (humwindow), humbox1); gtk_widget_show (humbox1); humbox2 = gtk_hbox_new (FALSE, 0); gtk_container_border_width (GTK_CONTAINER (humbox2), 0); gtk_box_pack_start (GTK_BOX (humbox1), humbox2, FALSE, FALSE, 0); gtk_widget_show (humbox2); humtable1 = gtk_table_new (1, 3, FALSE); gtk_box_pack_start (GTK_BOX (humbox2), humtable1, TRUE, TRUE, 0); gtk_widget_show (humtable1); humentry = gtk_entry_new_with_max_length (50); gtk_signal_connect (GTK_OBJECT (humentry), "activate", GTK_SIGNAL_FUNC (ActivateHuman), NULL); if ((ichangecolorh == 1) && (wiscomputer == 0)) { gtk_entry_set_text (GTK_ENTRY (humentry), wplayername); gtk_entry_select_region (GTK_ENTRY (humentry), 0, GTK_ENTRY (humentry)->text_length); } if ((ichangecolorh == 2) && (biscomputer == 0)) { gtk_entry_set_text (GTK_ENTRY (humentry), bplayername); gtk_entry_select_region (GTK_ENTRY (humentry), 0, GTK_ENTRY (humentry)->text_length); } gtk_table_attach (GTK_TABLE (humtable1), humentry, 0, 1, 0, 1, GTK_EXPAND, GTK_EXPAND, 10, 10); gtk_widget_grab_focus (humentry); gtk_widget_show (humentry); humsep = gtk_hseparator_new (); gtk_table_attach (GTK_TABLE (humtable1), humsep, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (humsep); #ifdef USE_GNOME humbutton = gnome_stock_button (GNOME_STOCK_BUTTON_OK); #else humbutton = gtk_button_new_with_label ("OK"); #endif gtk_signal_connect (GTK_OBJECT (humbutton), "clicked", GTK_SIGNAL_FUNC (ActivateHuman), NULL); GTK_WIDGET_SET_FLAGS (humbutton, GTK_CAN_DEFAULT); gtk_window_set_default (GTK_WINDOW (humwindow), humbutton); gtk_table_attach (GTK_TABLE (humtable1), humbutton, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 2, 2); gtk_widget_show (humbutton); gtk_widget_show (humwindow); iyesno = 1; } }