示例#1
0
int
nsSetupTypeDlg::Hide()
{
    gtk_widget_hide(mTable);

    // disconnect and remove this dlg's nav btn
    gtk_signal_disconnect(GTK_OBJECT(sBrowseBtn), sBrowseBtnID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);
    gtk_container_remove(GTK_CONTAINER(gCtx->next), gCtx->nextLabel); 
    gtk_widget_hide(gCtx->next);

    return OK;
}
示例#2
0
gboolean
button_press(GtkWidget *drawing_area, GdkEventButton *event, gpointer action)
{
  if (event->button == 1) /* left button */
    {
      ox = (int)event->x;
      oy = (int)event->y;
      
      erase_rubberbox(drawing_area);
    }
  else if (event->button == 3) /* right button */
    {
      if (GPOINTER_TO_UINT(action) == ACTION_LCD_COORDS)
	{
	  skin_infos.lcd_pos.top = tmp_rect.y;
	  skin_infos.lcd_pos.left = tmp_rect.x;
	  skin_infos.lcd_pos.bottom = tmp_rect.y + tmp_rect.h;
	  skin_infos.lcd_pos.right = tmp_rect.x + tmp_rect.w;

	  gtk_signal_disconnect(GTK_OBJECT(drawing_area),
				lcd_mouse_motion);

	  gtk_signal_disconnect(GTK_OBJECT(drawing_area),
				lcd_button_press);

	  lcd_mouse_motion = 0;
	  lcd_button_press = 0;

	  erase_rubberbox(drawing_area);

	  sbar_print(_("Saved LCD coordinates"));
	}
      else
	{
	  skin_infos.keys_pos[clist_row].top = tmp_rect.y;
	  skin_infos.keys_pos[clist_row].left = tmp_rect.x;
	  skin_infos.keys_pos[clist_row].bottom = tmp_rect.y + tmp_rect.h;
	  skin_infos.keys_pos[clist_row].right = tmp_rect.x + tmp_rect.w;

	  gtk_clist_moveto(GTK_CLIST(lookup_widget(GTK_WIDGET(list_keys_dialog), "list_keys")),
			   (((clist_row + 1) < clist_max) ? (clist_row + 1) : 0), 0, 0.5, 0);

	  gtk_clist_select_row(GTK_CLIST(lookup_widget(GTK_WIDGET(list_keys_dialog), "list_keys")),
			       (((clist_row + 1) < clist_max) ? (clist_row + 1) : 0), 0);
	}
    }
  
  return FALSE;
}
示例#3
0
void
nsComponentsDlg::Back(GtkWidget *aWidget, gpointer aData)
{
    DUMP("Back");
    if (aData != gCtx->cdlg) return;

    // hide this notebook page
    gCtx->cdlg->Hide(nsXInstallerDlg::BACKWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);

    gCtx->sdlg->Show(nsXInstallerDlg::BACKWARD_MOVE);
}
示例#4
0
文件: menu.cpp 项目: beanhome/dev
bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
{
    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );

    wxCHECK_MSG( menu != NULL, false, wxT("invalid popup-menu") );

    // NOTE: if you change this code, you need to update
    //       the same code in taskbar.cpp as well. This
    //       is ugly code duplication, I know.

    menu->UpdateUI();

    bool is_waiting = true;

    gulong handler = gtk_signal_connect( GTK_OBJECT(menu->m_menu),
                                         "hide",
                                         GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
                                         (gpointer)&is_waiting );

    wxPoint pos;
    gpointer userdata;
    GtkMenuPositionFunc posfunc;
    if ( x == -1 && y == -1 )
    {
        // use GTK's default positioning algorithm
        userdata = NULL;
        posfunc = NULL;
    }
    else
    {
        pos = ClientToScreen(wxPoint(x, y));
        userdata = &pos;
        posfunc = wxPopupMenuPositionCallback;
    }

    wxMenuEvent eventOpen(wxEVT_MENU_OPEN, -1, menu);
    DoCommonMenuCallbackCode(menu, eventOpen);

    gtk_menu_popup(
                  GTK_MENU(menu->m_menu),
                  NULL,           // parent menu shell
                  NULL,           // parent menu item
                  posfunc,                      // function to position it
                  userdata,                     // client data
                  0,                            // button used to activate it
                  wxGtkTimeLastClick            // the time of activation
                );

    while (is_waiting)
    {
        gtk_main_iteration();
    }

    gtk_signal_disconnect(GTK_OBJECT(menu->m_menu), handler);

    wxMenuEvent eventClose(wxEVT_MENU_CLOSE, -1, menu);
    DoCommonMenuCallbackCode(menu, eventClose);

    return true;
}
示例#5
0
void
bst_canvas_link_set_icsource (BstCanvasLink   *clink,
			      BstCanvasSource *icsource,
			      guint            ichannel)
{
  g_return_if_fail (BST_IS_CANVAS_LINK (clink));
  if (icsource)
    g_return_if_fail (BST_CANVAS_SOURCE (icsource));
  
  if (clink->icsource)
    {
      if (clink->icsource->source) /* source may be destroyed already */
	bse_proxy_disconnect (clink->icsource->source,
			      "any_signal", clink_view_check_update, clink,
			      NULL);
      if (g_signal_handler_is_connected (clink->icsource, clink->ic_handler))
        gtk_signal_disconnect (GTK_OBJECT (clink->icsource), clink->ic_handler);
      gtk_object_unref (GTK_OBJECT (clink->icsource));
    }
  clink->icsource = icsource;
  clink->ichannel = ichannel;
  if (clink->icsource)
    {
      gtk_object_ref (GTK_OBJECT (clink->icsource));
      clink->ic_handler = gtk_signal_connect_object (GTK_OBJECT (clink->icsource),
						     "notify",
						     G_CALLBACK (bst_canvas_link_update),
						     GTK_OBJECT (clink));
      bse_proxy_connect (clink->icsource->source,
			 "swapped_signal::property-notify::uname", clink_view_check_update, clink,
			 NULL);
      bst_canvas_link_update (clink);
    }
}
示例#6
0
void
nsSetupTypeDlg::Back(GtkWidget *aWidget, gpointer aData)
{
    DUMP("Back");
    if (aData != gCtx->sdlg) return;

    // hide this notebook page
    gCtx->sdlg->Hide(nsXInstallerDlg::BACKWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);
    gtk_signal_disconnect(GTK_OBJECT(sBrowseBtn), sBrowseBtnID);

    // show the next dlg
    gCtx->ldlg->Show(nsXInstallerDlg::BACKWARD_MOVE);
}
示例#7
0
void 
nsSetupTypeDlg::Next(GtkWidget *aWidget, gpointer aData)
{
    DUMP("Next");
    if (aData != gCtx->sdlg) return;

    GSList *s = gCtx->sdlg->mRadioGroup;
    gCtx->opt->mSetupType = 0;
    while (s) {
      if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(s->data)))
        break;

      ++gCtx->opt->mSetupType;
      s = s->next;
    }

    // verify selected destination directory exists
    if (OK != nsSetupTypeDlg::VerifyDestination())
        return;

    // old installation may exist: delete it
    if (OK != nsSetupTypeDlg::DeleteOldInst())
        return;

    // if not custom setup type verify disk space
    if (gCtx->opt->mSetupType != (gCtx->sdlg->GetNumSetupTypes() - 1))
    {
        if (OK != nsSetupTypeDlg::VerifyDiskSpace())
            return;
    }

    // hide this notebook page
    gCtx->sdlg->Hide(nsXInstallerDlg::FORWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);
    gtk_signal_disconnect(GTK_OBJECT(sBrowseBtn), sBrowseBtnID);

    // show the last dlg
    if (gCtx->opt->mSetupType == (gCtx->sdlg->GetNumSetupTypes() - 1))
        gCtx->cdlg->Show(nsXInstallerDlg::FORWARD_MOVE);
    else
        gCtx->idlg->Show(nsXInstallerDlg::FORWARD_MOVE);
}
示例#8
0
bool wxTaskBarIconAreaBase::DoPopupMenu( wxMenu *menu, int x, int y )
{
    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );

    wxCHECK_MSG( menu != NULL, false, wxT("invalid popup-menu") );

    // NOTE: if you change this code, you need to update
    //       the same code in window.cpp as well. This
    //       is ugly code duplication, I know,

    SetInvokingWindow( menu, this );

    menu->UpdateUI( m_invokingWindow );

    bool is_waiting = true;

    gulong handler = gtk_signal_connect( GTK_OBJECT(menu->m_menu),
                                         "hide",
                                         GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
                                         (gpointer)&is_waiting );

    wxPoint pos;
    gpointer userdata;
    GtkMenuPositionFunc posfunc;
    if ( x == -1 && y == -1 )
    {
        // use GTK's default positioning algorithm
        userdata = NULL;
        posfunc = NULL;
    }
    else
    {
        pos = ClientToScreen(wxPoint(x, y));
        userdata = &pos;
        posfunc = wxPopupMenuPositionCallback;
    }

    gtk_menu_popup(
                  GTK_MENU(menu->m_menu),
                  (GtkWidget *) NULL,           // parent menu shell
                  (GtkWidget *) NULL,           // parent menu item
                  posfunc,                      // function to position it
                  userdata,                     // client data
                  0,                            // button used to activate it
                  gtk_get_current_event_time()
                );

    while (is_waiting)
    {
        gtk_main_iteration();
    }

    gtk_signal_disconnect(GTK_OBJECT(menu->m_menu), handler);

    return true;
}
示例#9
0
void
nsComponentsDlg::Next(GtkWidget *aWidget, gpointer aData)
{
    DUMP("Next");
    if (aData != gCtx->cdlg) return;

	if (OK != nsSetupTypeDlg::VerifyDiskSpace())
	    return;

    // hide this notebook page
    gCtx->cdlg->Hide(nsXInstallerDlg::FORWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);

    // show the next dlg
    gCtx->idlg->Show(nsXInstallerDlg::FORWARD_MOVE);
}
示例#10
0
文件: gtkcombo.c 项目: Onjrew/OpenEV
void
gtk_combo_disable_activate (GtkCombo* combo)
{
  g_return_if_fail (combo != NULL);
  g_return_if_fail (GTK_IS_COMBO (combo));

  if ( combo->activate_id ) {
    gtk_signal_disconnect(GTK_OBJECT(combo->entry), combo->activate_id);
    combo->activate_id = 0;
  }
}
示例#11
0
文件: object.c 项目: amery/clip-itk
int
clip_GTK_SIGNALDISCONNECT(ClipMachine *cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	int    conn_id = _clip_parni(cm,2);
	CHECKCWID(cwid,GTK_IS_OBJECT);
	CHECKARG(2,NUMERIC_t);
	gtk_signal_disconnect(GTK_OBJECT(cwid->widget),conn_id);
	return 0;
err:
	return 1;
}
示例#12
0
int 
nsWelcomeDlg::Hide()
{
    // hide all this dlg's widgets
    gtk_widget_hide(mTable);

    // disconnect and remove this dlg's nav btn
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);
    gtk_container_remove(GTK_CONTAINER(gCtx->next), gCtx->nextLabel);
    gtk_widget_hide(gCtx->next);

    return OK;
}
示例#13
0
int get_val(gpointer data, gint fd, GdkInputCondition val)
{
	char c[2];
	read(fd, c, 2);
	if(c[0] & QUIT) {
		fflush(stdout);
	}
	return_val = (int) c[0];
	gdk_input_remove(tag);
	gtk_signal_disconnect(GTK_OBJECT(my_mainwin), my_handler_id);
	gtk_main_quit();
	return 1;
}
示例#14
0
static void display_input_clicked(void)
{
  display_input_enabled = gtk_toggle_tool_button_get_active(display_button_input);
  if ( display_input_enabled ) {
    display_darea_scroll = gtk_signal_connect(GTK_OBJECT(display_darea), "scroll_event",
					      GTK_SIGNAL_FUNC(display_event_scroll), NULL);
    display_cursor_show(0);
  }
  else {
    if ( display_darea_scroll >= 0 )
      gtk_signal_disconnect(GTK_OBJECT(display_darea), display_darea_scroll);
    display_darea_scroll = -1;
    display_cursor_show(1);
  }
}
示例#15
0
/*  2  */
int appAppAskForPaste(		EditApplication *	ea,
				const char *		selection )
    {
    int		rval;
    guint	id;

    id= gtk_signal_connect( GTK_OBJECT( ea->eaToplevel.atTopWidget ),
						"selection_received",
						(GtkSignalFunc)appAppGotPaste,
						(void *)ea );

    rval= appAskForPaste( ea->eaToplevel.atTopWidget, ea, selection );

    gtk_signal_disconnect( GTK_OBJECT( ea->eaToplevel.atTopWidget ), id );

    return rval;
    }
示例#16
0
int appDocAskForPaste(		EditDocument *		ed,
				const char *		selection )
    {
    int		rval;
    guint	id;

    id= gtk_signal_connect( GTK_OBJECT( ed->edDocumentWidget ),
					"selection_received",
					(GtkSignalFunc)appDocGotPasteReply,
					(void *)ed );

    rval= appAskForPaste( ed->edDocumentWidget,
					ed->edApplication, selection );

    gtk_signal_disconnect( GTK_OBJECT( ed->edDocumentWidget ), id );

    return rval;
    }
示例#17
0
文件: dlg.c 项目: imclab/rgba
/*
static void PreMult (TImage image)
{
    int i;
    unsigned char *p;

    p = (unsigned char *) image->data;

    for (i=0; i<image->width*image->height*4; i+=4, p+=4)
    {
        p[0] = (p[0] * p[3] >> 8) + ((0xFF - p[3]) * 0xFF >> 8);
        p[1] = (p[1] * p[3] >> 8) + ((0xFF - p[3]) * 0xFF >> 8);
        p[2] = (p[2] * p[3] >> 8) + ((0xFF - p[3]) * 0xFF >> 8);
        p[3] = 0xFF;
    }
}

static GtkWidget *create_pixmap_png (GtkWidget       *widget,
                                     const gchar     *filename)
{
    TImage image;
    GtkWidget *pixmap;
    GdkPixmap *gdkpixmap;
    GdkGC     *gc;

    image = IMG_Read ((char *)filename);
    if (!image)
    {
        printf ("IMG_Read error: can't load %s\n", filename);
        exit (1);
    }
    PreMult (image);
    //printf ("%ix%i\n", image->width, image->height);
    gdkpixmap = gdk_pixmap_new (NULL,
                                IMG_GetWidth(image),
                                IMG_GetHeight(image),
                                (gtk_widget_get_visual (widget))->depth);
    gc = gdk_gc_new (gdkpixmap);
    gdk_rgb_init ();
    gdk_draw_rgb_32_image (gdkpixmap, gc, 0, 0,
                           IMG_GetWidth (image),
                           IMG_GetHeight (image),
                           GDK_RGB_DITHER_NONE,
                           (unsigned char *) IMG_GetData (image),
                           IMG_GetWidth (image) * 4);

    pixmap = gtk_pixmap_new (gdkpixmap, NULL);
    gdk_gc_unref (gc);
    gdk_pixmap_unref (gdkpixmap);
    IMG_Delete (image);

    return pixmap;
}
*/
void DLG_Show (TDialogData *dd, const char *demo_name)
{
    GtkWidget *window1;
    GtkWidget *fixed1;
    GtkWidget *button1;
//    GtkWidget *pixmap1;
    GtkWidget *button2;
    GtkWidget *frame1;
    GtkWidget *fixed2;
    GtkWidget *label1;
    GtkWidget *label2;
    GtkWidget *combo1;
    GtkWidget *combo_entry1;
    GtkWidget *checkbutton1;
    GList     *glist;
    int        dest_signal;
    char      *res;

    gtk_init (NULL, NULL);

    window1 = gtk_window_new (GTK_WINDOW_DIALOG);
    gtk_object_set_data (GTK_OBJECT (window1), "window1", window1);
    gtk_widget_set_usize (window1, 256+16*2, 150);
    gtk_window_set_title (GTK_WINDOW (window1), _(demo_name));
    gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_CENTER);
    gtk_window_set_modal (GTK_WINDOW (window1), TRUE);
    gtk_window_set_policy (GTK_WINDOW (window1), FALSE, FALSE, FALSE);

    fixed1 = gtk_fixed_new ();
    gtk_widget_ref (fixed1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "fixed1", fixed1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (fixed1);
    gtk_container_add (GTK_CONTAINER (window1), fixed1);

    button1 = gtk_button_new_with_label (_("run"));
    gtk_widget_ref (button1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "button1", button1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (button1);
    gtk_fixed_put (GTK_FIXED (fixed1), button1, 64, 112);
    gtk_widget_set_uposition (button1, 64, 112);
    gtk_widget_set_usize (button1, 47, 22);
    gtk_signal_connect (GTK_OBJECT (button1), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

    //pixmap1 = create_pixmap_xpm (window1, "navmo.xpm");
/*
    pixmap1 = create_pixmap_png (window1, "menu/navmo.png");
    gtk_widget_ref (pixmap1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "pixmap1", pixmap1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (pixmap1);
    gtk_fixed_put (GTK_FIXED (fixed1), pixmap1, 128, 64);
    gtk_widget_set_uposition (pixmap1, 128, 64);
    gtk_widget_set_usize (pixmap1, 21, 21);
*/
    button2 = gtk_button_new_with_label (_("exit"));
    gtk_widget_ref (button2);
    gtk_object_set_data_full (GTK_OBJECT (window1), "button2", button2,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (button2);
    gtk_fixed_put (GTK_FIXED (fixed1), button2, 174, 112);
    gtk_widget_set_uposition (button2, 174, 112);
    gtk_widget_set_usize (button2, 47, 22);
    gtk_signal_connect (GTK_OBJECT (button2), "clicked", GTK_SIGNAL_FUNC (gtk_exit), NULL);

    frame1 = gtk_frame_new (_(demo_name));
    gtk_widget_ref (frame1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "frame1", frame1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (frame1);
    gtk_fixed_put (GTK_FIXED (fixed1), frame1, 16, 11);
    gtk_widget_set_uposition (frame1, 16, 11);
    gtk_widget_set_usize (frame1, 256, 95);
    gtk_frame_set_label_align (GTK_FRAME (frame1), 0.5, 0.5);
    gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_ETCHED_OUT);

    fixed2 = gtk_fixed_new ();
    gtk_widget_ref (fixed2);
    gtk_object_set_data_full (GTK_OBJECT (window1), "fixed2", fixed2,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (fixed2);
    gtk_container_add (GTK_CONTAINER (frame1), fixed2);

    label1 = gtk_label_new (_(">> windowed ::"));
    gtk_widget_ref (label1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "label1", label1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (label1);
    gtk_fixed_put (GTK_FIXED (fixed2), label1, 16, 12);
    gtk_widget_set_uposition (label1, 16, 12);
    gtk_widget_set_usize (label1, 100, 16);

    label2 = gtk_label_new (_(">> resolution ::"));
    gtk_widget_ref (label2);
    gtk_object_set_data_full (GTK_OBJECT (window1), "label2", label2,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (label2);
    gtk_fixed_put (GTK_FIXED (fixed2), label2, 16, 44);
    gtk_widget_set_uposition (label2, 16, 44);
    gtk_widget_set_usize (label2, 100, 16);

    combo1 = gtk_combo_new ();
    gtk_widget_ref (combo1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "combo1", combo1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (combo1);
    gtk_fixed_put (GTK_FIXED (fixed2), combo1, 112, 41);
    gtk_widget_set_uposition (combo1, 112, 41);
    gtk_widget_set_usize (combo1, 108, 22);

    combo_entry1 = GTK_COMBO (combo1)->entry;
    gtk_widget_ref (combo_entry1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "combo_entry1", combo_entry1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (combo_entry1);

    checkbutton1 = gtk_check_button_new_with_label ("");
    gtk_widget_ref (checkbutton1);
    gtk_object_set_data_full (GTK_OBJECT (window1), "checkbutton1", checkbutton1,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (checkbutton1);
    gtk_fixed_put (GTK_FIXED (fixed2), checkbutton1, 203, 7);
    gtk_widget_set_uposition (checkbutton1, 203, 7);
    gtk_widget_set_usize (checkbutton1, 16, 24);
    GTK_WIDGET_UNSET_FLAGS (checkbutton1, GTK_CAN_FOCUS);


    glist = NULL;
    glist = g_list_append (glist, "320x200");
    glist = g_list_append (glist, "320x240");
    glist = g_list_append (glist, "640x400");
    glist = g_list_append (glist, "640x480");
    glist = g_list_append (glist, "800x600");
    glist = g_list_append (glist, "1024x768");
    glist = g_list_append (glist, "1280x1024");
    gtk_combo_set_popdown_strings (GTK_COMBO(combo1), glist);
    gtk_entry_set_text (GTK_ENTRY(combo_entry1), "800x600");

    dest_signal = gtk_signal_connect (GTK_OBJECT (window1), "destroy", GTK_SIGNAL_FUNC (gtk_exit), NULL);
    gtk_widget_show (window1);

    gtk_main ( );


    // Get resolution
    res = gtk_entry_get_text (GTK_ENTRY(combo_entry1));
    if (!strcmp (res, "320x200"))
    {
        dd->width  = 320;
        dd->height = 200;
    }
    else if (!strcmp (res, "320x240"))
    {
        dd->width  = 320;
        dd->height = 240;
    }
    else if (!strcmp (res, "640x400"))
    {
        dd->width  = 640;
        dd->height = 400;
    }
    else if (!strcmp (res, "640x480"))
    {
        dd->width  = 640;
        dd->height = 480;
    }
    else if (!strcmp (res, "800x600"))
    {
        dd->width  = 800;
        dd->height = 600;
    }
    else if (!strcmp (res, "1024x768"))
    {
        dd->width  = 1024;
        dd->height = 768;
    }
    else if (!strcmp (res, "1280x1024"))
    {
        dd->width  = 1280;
        dd->height = 1024;
    }
    else
    {
        // default 800x600
        dd->width  = 800;
        dd->height = 600;
    }

    dd->windowed = (int) GTK_TOGGLE_BUTTON (checkbutton1)->active;

    gtk_signal_disconnect (GTK_OBJECT (window1), dest_signal);
    gtk_widget_hide (window1);
    gtk_widget_destroy (window1);
    gtk_main_iteration_do (0);
}
示例#18
0
bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
                         const wxPoint& pos, const wxSize& size,
                         int n, const wxString choices[],
                         long style, const wxValidator& validator,
                         const wxString& name )
{
    m_ignoreNextUpdate = false;
    m_needParent = true;
    m_acceptsFocus = true;
    m_prevSelection = 0;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxComboBox creation failed") );
        return false;
    }

    m_widget = gtk_combo_new();
    GtkCombo *combo = GTK_COMBO(m_widget);

    // Disable GTK's broken events ...
    gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
    // ... and add surrogate handler.
    combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
                  (GtkSignalFunc) gtk_dummy_callback, combo);

    // make it more useable
    gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );

    // and case-sensitive
    gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );

    GtkWidget *list = GTK_COMBO(m_widget)->list;

    // gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );

    for (int i = 0; i < n; i++)
    {
        GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) );

        m_clientDataList.Append( (wxObject*)NULL );
        m_clientObjectList.Append( (wxObject*)NULL );

        gtk_container_add( GTK_CONTAINER(list), list_item );

        gtk_widget_show( list_item );
    }

    m_parent->DoAddChild( this );

    m_focusWidget = combo->entry;

    PostCreation(size);

    ConnectWidget( combo->button );

    // MSW's combo box shows the value and the selection is -1
    gtk_entry_set_text( GTK_ENTRY(combo->entry), wxGTK_CONV(value) );
    gtk_list_unselect_all( GTK_LIST(combo->list) );

    if (style & wxCB_READONLY)
        gtk_entry_set_editable( GTK_ENTRY( combo->entry ), FALSE );

    // "show" and "hide" events are generated when user click on the combobox button which popups a list
    // this list is the "popwin" gtk widget
    gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide",
                        GTK_SIGNAL_FUNC(gtk_popup_hide_callback), (gpointer)this );
    gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "show",
                        GTK_SIGNAL_FUNC(gtk_popup_show_callback), (gpointer)this );

    gtk_signal_connect_after( GTK_OBJECT(combo->entry), "changed",
      GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );

    gtk_signal_connect_after( GTK_OBJECT(combo->list), "select-child",
      GTK_SIGNAL_FUNC(gtk_combo_select_child_callback), (gpointer)this );

    SetInitialSize(size); // need this too because this is a wxControlWithItems

    // This is required for tool bar support
//    wxSize setsize = GetSize();
//    gtk_widget_set_usize( m_widget, setsize.x, setsize.y );

    return true;
}
示例#19
0
文件: term_menu.c 项目: xaizek/vide
static void
detach_term(GtkWidget *widget, ZvtTerm *term)
{
	GtkWidget *term_window;
	GtkWidget *menu_bar;
	GtkWidget *vbox;
	GtkWidget *term_label;
	gchar *label_text;
	gint term_count;
	guint child_died_signal_id;
	guint title_change_signal;

	vbox = gtk_object_get_data(GTK_OBJECT(term), "vbox");
	term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox),
				"term_count"));
	child_died_signal_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"child_died_signal_id"));
	gtk_signal_disconnect(GTK_OBJECT(term), child_died_signal_id);
	title_change_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"title_change_signal"));
	gtk_signal_disconnect(GTK_OBJECT(term), title_change_signal);
	term_label = gtk_object_get_data(GTK_OBJECT(term), "term_label");
	gtk_label_get(GTK_LABEL(term_label), &label_text);

	term_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(term_window), label_text);
	gtk_signal_connect(GTK_OBJECT(term_window), "delete-event",
			GTK_SIGNAL_FUNC(gtk_widget_destroy), term_window);
	gtk_widget_realize(term_window);


	menu_bar = gtk_object_get_data(GTK_OBJECT(term), "menubar");
	gtk_widget_destroy(menu_bar);

	/* Need to use ref and unref with reparent here - don't know why? */
	gtk_widget_ref(GTK_WIDGET(term));
	gtk_widget_reparent(GTK_WIDGET(term), term_window);
	gtk_widget_unref(GTK_WIDGET(term));

	gtk_signal_connect(GTK_OBJECT(term), "child_died",
			GTK_SIGNAL_FUNC(close_term_window), NULL);
	gtk_signal_connect(GTK_OBJECT(term), "title_changed",
			GTK_SIGNAL_FUNC(change_title), term_window);

	
	gtk_widget_grab_focus(GTK_WIDGET(term));

	gtk_widget_show(term_window);

	if(term_count > 1)
	{
		GList *child, *tmp;
		ZvtTerm *tmp_term;
		GtkWidget *ch;
		GtkWidget *page_label;
		GtkWidget *term_label;
		char *label_text;
		gchar buf[NAME_MAX];

		term_count--;
		gtk_object_set_data(GTK_OBJECT(vbox), "term_count",
				GUINT_TO_POINTER(term_count));
		child = GTK_BOX(vbox)->children;

		term_count = 0;
		for(tmp = child; tmp != NULL; tmp = tmp->next)
		{
			ch = ((GtkBoxChild*)(tmp->data))->widget;
			if(ZVT_IS_TERM(ch))
			{
				term_count++;
				gtk_object_set_data(GTK_OBJECT(ch), "term_number",
							GUINT_TO_POINTER(term_count));
			}
		}
		tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook),
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)));
		term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(tmp_term),
					"term_number"));
		gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", 
				GUINT_TO_POINTER(term_count));
		cfg.current_term = tmp_term;
		term_label = gtk_object_get_data(GTK_OBJECT(tmp_term), "term_label");
	 	page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), 
		gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook))));
		gtk_label_get(GTK_LABEL(term_label), &label_text);
		g_snprintf(buf, sizeof(buf), "%d %s",
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) +1,
			 label_text);
		gtk_label_set_text(GTK_LABEL(page_label), buf);


		gtk_widget_grab_focus(GTK_WIDGET(tmp_term));


	}
	else
	{
		gint page;
		gtk_widget_destroy(GTK_WIDGET(vbox));
		gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1);
		page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook));
		if(page == 0)
		{
			cfg.term_count = 0;
			cfg.current_term = NULL;
		}
	}
}