Example #1
0
bool wxFontDialog::DoCreate(wxWindow *parent)
{
    m_needParent = false;

    if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
        !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
                     wxDefaultValidator, wxT("fontdialog") ))
    {
        wxFAIL_MSG( wxT("wxFontDialog creation failed") );
        return false;
    }

    wxString m_message( _("Choose font") );
    m_widget = gtk_font_selection_dialog_new( wxGTK_CONV( m_message ) );

    if (parent)
        gtk_window_set_transient_for(GTK_WINDOW(m_widget),
                                     GTK_WINDOW(parent->m_widget));

    GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget);

    gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
      GTK_SIGNAL_FUNC(gtk_fontdialog_ok_callback), (gpointer*)this );

    // strange way to internationalize
    gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->ok_button) ), _("OK") );

    gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
      GTK_SIGNAL_FUNC(gtk_fontdialog_cancel_callback), (gpointer*)this );

    // strange way to internationalize
    gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->cancel_button) ), _("Cancel") );

    gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
        GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );

    wxFont font = m_fontData.GetInitialFont();
    if( font.IsOk() )
    {
        const wxNativeFontInfo *info = font.GetNativeFontInfo();

        if ( info )
        {

            const wxString& fontname = info->GetXFontName();
            if ( !fontname )
                font.GetInternalFont();

            gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname));
        }
        else
        {
            // this is not supposed to happen!
            wxFAIL_MSG(wxT("font is ok but no native font info?"));
        }
    }

    return true;
}
Example #2
0
void calendar_set_signal_strings( char         *sig_str,
				  CalendarData *data)
{
  gchar *prev_sig;

  gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
  gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);

  gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
  gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
  gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
}
void CInstaller::CoreUpdateLanguage()
{
    CBaseInstall::CoreUpdateLanguage();
    
    SetAboutLabel();
    
    gtk_label_set(GTK_LABEL(m_pCancelLabel), GetTranslation("Cancel"));
    gtk_label_set(GTK_LABEL(m_pBackLabel), GetTranslation("Back"));
    UpdateButtons(); // Sets Next label

    if (!m_CurTitle.empty())
        SetTitle(m_CurTitle);
}
Example #4
0
void Modify_Key_Press(GtkWidget *w, GdkEventKey *e)
{
	char YouPressed[128];
	Modify_Key_Chosen = e->keyval;
	sprintf(YouPressed, "You pressed : %d\nClick OK to keep this key.", e->keyval);
	gtk_label_set(GTK_LABEL(mkLabel), YouPressed);
}
static void
x_set_text (GtkWidget *w, gpointer data)
{
	if (!GTK_IS_LABEL (w))
		return;
	gtk_label_set (GTK_LABEL(w), data);
}
void
view_percent (WView *view, int p, int w)
{
    int percent;
    char buffer [40];

    percent = (view->s.st_size == 0 || view->last_byte == view->last) ? 100 :
        (p > (INT_MAX/100) ?
         p / (view->s.st_size / 100) :
	 p * 100 / view->s.st_size);

    sprintf (buffer, "%3d%%", percent);
    if (strcmp (buffer, GTK_LABEL (view->gtk_percent)->label))
	    gtk_label_set (GTK_LABEL (view->gtk_percent), buffer);

    if (view->sadj){
	    GtkAdjustment *adj = GTK_ADJUSTMENT (view->sadj);
	    
	    if ((int) adj->upper != view->last_byte){
		    adj->upper = view->last_byte;
		    adj->step_increment = 1.0;
		    adj->page_increment = 
			    adj->page_size = view->last - view->start_display;
		    gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
	    }
	    if ((int) adj->value != view->start_display){
		    gtk_adjustment_set_value (adj, view->start_display);
	    }
    }
}
Example #7
0
void game_start_stop(GtkMenuItem     *widget,
		     gpointer user_data)
{
  game_play=!game_play;
  gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE);
  if(game_play)
    {
      gtk_widget_set_sensitive(menu_game_stop,TRUE);
      gtk_widget_set_sensitive(menu_game_quick,FALSE);
      gtk_widget_set_sensitive(menu_game_start,FALSE);
      gtk_widget_set_sensitive(Start_stop_button,TRUE);
      gtk_label_set(GTK_LABEL(Start_stop_button_label),start_stop_str[1]);
      gtk_widget_set_sensitive(Pause_button,TRUE);
      gtk_widget_grab_default(Pause_button);
      game_init();
      make_noise(options.noise_l,options.noise_h);
      from_virtual();
      move_block(0,0,0);
      current_level = options.level;
      update_game_values(0,current_level,0);
      timer = gtk_timeout_add(level_speeds[current_level],(GtkFunction)game_loop,NULL);
    }
  else
    game_over_init();
}
Example #8
0
void wxStaticText::SetLabel( const wxString &label )
{
    wxControl::SetLabel(label);

#ifdef __WXGTK20__
    // Build the colorized version of the label (markup only allowed
    // under GTK2):
    if (m_foregroundColour.Ok())
    {
        // If the color has been set, create a markup string to pass to
        // the label setter
        wxString colorlabel;
        colorlabel.Printf(_T("<span foreground=\"#%02x%02x%02x\">%s</span>"),
                          m_foregroundColour.Red(), m_foregroundColour.Green(),
                          m_foregroundColour.Blue(),
                          wxEscapeStringForPangoMarkup(label).c_str());
        gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) );
    }
    else
#endif
        gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );

    // adjust the label size to the new label unless disabled
    if (!HasFlag(wxST_NO_AUTORESIZE))
    {
        InvalidateBestSize();
        SetSize( GetBestSize() );
    }
}
Example #9
0
void wxMenuBar::SetMenuLabel( size_t pos, const wxString& label )
{
    wxMenuList::compatibility_iterator node = m_menus.Item( pos );

    wxCHECK_RET( node, wxT("menu not found") );

    wxMenu* menu = node->GetData();

    const wxString str( wxReplaceUnderscore( label ) );

    menu->SetTitle( str );

    if (menu->m_owner)
    {
        GtkLabel *glabel = GTK_LABEL( GTK_BIN(menu->m_owner)->child );

        /* set new text */
        gtk_label_set( glabel, wxGTK_CONV( str ) );

        /* reparse key accel */
        (void)gtk_label_parse_uline (GTK_LABEL(glabel), wxGTK_CONV( str ) );
        gtk_accel_label_refetch( GTK_ACCEL_LABEL(glabel) );
    }

}
Example #10
0
void wxButton::SetLabel( const wxString &lbl )
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid button") );

    wxString label(lbl);

    if (label.empty() && wxIsStockID(m_windowId))
        label = wxGetStockLabel(m_windowId);

    wxControl::SetLabel(label);

#ifdef __WXGTK20__
    if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
    {
        const char *stock = wxGetStockGtkID(m_windowId);
        if (stock)
        {
            gtk_button_set_label(GTK_BUTTON(m_widget), stock);
            gtk_button_set_use_stock(GTK_BUTTON(m_widget), TRUE);
            return;
        }
    }

    wxString label2 = PrepareLabelMnemonics(label);
    gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(label2));
    gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
    
    ApplyWidgetStyle( false );
    
#else
    gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(GetLabel()));
#endif
}
Example #11
0
gboolean zmien_wyjscie( GtkWidget *widget, GdkEventCrossing *event, gpointer data )
{
    char buf[ 1000 ];
    char *dupa;
    int door;
    ROOM_INDEX_DATA *room = dpom.room;

    door = GPOINTER_TO_INT( data );

    dupa = buf + sprintf( buf, "%s: ", kierunki[ door ].na_krew );
    if ( room->exit[ door ] )
    {
	if ( room->exit[ door ]->to_room )
	    sprintf( dupa, "#%d: \n%s\n%s",
		room->exit[ door ]->to_room->vnum,
		room->exit[ door ]->description,
		room->exit[ door ]->to_room->name );
	else
	    sprintf( dupa, "\n%s", "wyj`scie bez docelowego pomieszczenia." );
    }
    else
	sprintf( dupa, "\n%s", "brak wyj`scia" );

    gtk_label_set( GTK_LABEL( dpom.label_wyjscie ), _( buf ) );

    return FALSE;
}
Example #12
0
int
ftp_list_files (gftp_window_data * wdata)
{
  gftpui_callback_data * cdata;

  gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Receiving file names..."));

  cdata = g_malloc0 (sizeof (*cdata));
  cdata->request = wdata->request;
  cdata->uidata = wdata;
  cdata->run_function = gftpui_common_run_ls;
  cdata->dont_refresh = 1;

  gftpui_common_run_callback_function (cdata);

  wdata->files = cdata->files;
  g_free (cdata);
  
  if (wdata->files == NULL || !GFTP_IS_CONNECTED (wdata->request))
    {
      gftpui_disconnect (wdata);
      return (0);
    }

  wdata->sorted = 0;
  sortrows (GTK_CLIST (wdata->listbox), -1, (gpointer) wdata);

  if (IS_NONE_SELECTED (wdata))
    gtk_clist_select_row (GTK_CLIST (wdata->listbox), 0, 0);

  return (1);
}
Example #13
0
void aktualizuj_etykietki_wyjsc( void )
{
    char buf[ 1000 ];
    ROOM_INDEX_DATA *room = dpom.room;
    int i;

    if ( !room )
	return;

    for ( i = 0; i < 10; i++ )
    {
	if ( room->exit[ i ] )
	{
	    if ( room->exit[ i ]->to_room )
		sprintf( buf, "#%d", room->exit[ i ]->to_room->vnum );
	    else
		strcpy( buf, _( "(`sciana)" ) );
	}
	else
	    strcpy( buf, "-" );
	gtk_label_set( GTK_LABEL( dpom.label[ i ] ), buf );
    }

    return;
}
Example #14
0
static void
handle_reply (DBusGProxy * proxy,
              char       * OUT_out,
              GError     * error,
              gpointer     entry)
{
    if (error) {
        gchar* msg = g_strdup_printf (_("Error contacting the mirror service: %s:%d:%s%c%s"),
                                      g_quark_to_string (error->domain),
                                      error->code,
                                      error->message,
                                      g_error_matches (error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION) ? ':' : '\0',
                                      g_error_matches (error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION) ? dbus_g_error_get_name (error) : "");
        gtk_label_set_text (GTK_LABEL (error_label),
                            msg);
        g_free (msg);
        /* FIXME: free the error? */
    } else {
        gtk_label_set(GTK_LABEL(error_label), "");

        gtk_entry_set_text(GTK_ENTRY(entry), OUT_out);
    }

    gtk_widget_set_sensitive (entry, TRUE);
}
Example #15
0
void report_error(GError* error)
{
	if (error == NULL)
	{
		return;
	}
	
	if (error_info_bar == NULL)
	{
		error_count = 1;
		error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK,
		                                               GTK_RESPONSE_OK,
		                                               NULL);
		g_signal_connect(error_info_bar, "response", G_CALLBACK(on_info_bar_response), NULL);
		gtk_info_bar_set_message_type(GTK_INFO_BAR(error_info_bar),
		                              GTK_MESSAGE_ERROR);
		
		error_label = gtk_label_new(error->message);
		GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(error_info_bar));
		gtk_container_add(GTK_CONTAINER(container), error_label);
		
		gtk_box_pack_start(GTK_BOX(main_vbox), error_info_bar, FALSE, FALSE, 0);
		gtk_widget_show_all(main_vbox);
	}
	else
	{
		error_count++;
		char buffer[256];
		snprintf(buffer, sizeof(buffer), "Failed to open %i files.", error_count);
		gtk_label_set(GTK_LABEL(error_label), buffer);
	}
}
Example #16
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void i_update_middle_button(GSCHEM_TOPLEVEL *w_current,
			    void (*func_ptr)(),
			    const char *string)
{
  char *temp_string;

  if (func_ptr == NULL)
    return;

  if (string == NULL)
    return;

  if (!w_current->middle_label)
    return;

  switch(w_current->middle_button) {

    /* remove this case eventually and make it a null case */
    case(ACTION):
    gtk_label_set(GTK_LABEL(w_current->middle_label),
                  _("Action"));
    break;

#ifdef HAS_LIBSTROKE
    case(STROKE):
    gtk_label_set(GTK_LABEL(w_current->middle_label),
                  _("Stroke"));
    break;
#else 
    /* remove this case eventually and make it a null case */
    case(STROKE):
    gtk_label_set(GTK_LABEL(w_current->middle_label),
                  _("none"));
    break;
#endif
		
    case(REPEAT):
    temp_string = g_strconcat (_("Repeat/"), string, NULL);

    gtk_label_set(GTK_LABEL(w_current->middle_label),
                  temp_string);
    w_current->last_callback = func_ptr;
    g_free(temp_string);
    break;

  }
}
Example #17
0
static void
generic_cb(GtkWidget *widget, gpointer data)
{
    gtk_pipe_int_write(GPOINTER_TO_INT(data));
    if(GPOINTER_TO_INT(data) == GTK_PAUSE) {
	gtk_label_set(GTK_LABEL(cnt_lbl), "Pause");
    }
}
Example #18
0
void wxToggleButton::SetLabel(const wxString& label)
{
    wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));

    wxControl::SetLabel(label);

    gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
}
Example #19
0
int
ftp_connect (gftp_window_data * wdata, gftp_request * request)
{
  if (wdata->request == request)
    gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Connecting..."));

  return (gftpui_common_cmd_open (wdata, request, NULL, NULL, NULL));
}
Example #20
0
void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label)
{
    // don't call the virtual function which might call this one back again
    wxControl::SetLabel(label);

    const wxString labelGTK = GTKRemoveMnemonics(label);

    gtk_label_set(w, wxGTK_CONV(labelGTK));
}
Example #21
0
File: xqf-ui.c Project: IR4T4/xqf
static void clist_column_set_title (GtkCList *clist, struct clist_def *cldef, int set_mark) {
	char buf[256];

	if (set_mark) {
		const char* name = cldef->cols[clist->sort_column].sort_name[cldef->cols[clist->sort_column].current_sort_mode];
		g_snprintf (buf, 128, "%s %c", _(cldef->cols[clist->sort_column].name),
				(clist->sort_type == GTK_SORT_DESCENDING)? '>' : '<');

		if (name) {
			snprintf (buf+strlen(buf), sizeof(buf)-strlen(buf), " (%s)", _(name));
		}
		gtk_label_set (GTK_LABEL (cldef->cols[clist->sort_column].widget), buf);
	}
	else {
		gtk_label_set (GTK_LABEL (cldef->cols[clist->sort_column].widget),
				_(cldef->cols[clist->sort_column].name));
	}
}
Example #22
0
static void
set_score (int new_score)
{
	char b [20];
	
	score = new_score;
	sprintf (b, "%.5d", score);
	gtk_label_set (GTK_LABEL(scorew), b);
}
Example #23
0
void game_set_pause(GtkWidget    *menuitem,
		    gpointer         user_data)
{
   if (game_over)
    {
      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_game_pause),
				     FALSE);
      return;
    }
  game_pause = !game_pause;
  if(game_pause) {
    gtk_timeout_remove(timer);
    gtk_label_set(GTK_LABEL(Pause_button_label),pause_str[1]);
  }
  else {
    timer = gtk_timeout_add(level_speeds[current_level],
			    (GtkFunction)game_loop,NULL);
    gtk_label_set(GTK_LABEL(Pause_button_label),pause_str[0]);
  }
}
static void
set_title(void *opaque, const char *str)
{
  if(str != NULL) {
    char *m = g_markup_printf_escaped("<span size=\"x-large\">%s</span>", str);
    gtk_label_set_markup(GTK_LABEL(opaque), m);
    g_free(m);
  } else {
    gtk_label_set(GTK_LABEL(opaque), "");
  }
}
void CInstaller::UpdateButtons(void)
{
    CInstallScreen *curscreen = GetScreen(gtk_notebook_get_current_page(GTK_NOTEBOOK(m_pWizard)));
    
    if (FirstValidScreen() && !curscreen->HasPrevWidgets())
        gtk_widget_set_sensitive(m_pBackButton, FALSE);
    else if (!m_bPrevButtonLocked)
        gtk_widget_set_sensitive(m_pBackButton, TRUE);
    
    if (LastValidScreen() && !curscreen->HasNextWidgets())
    {
        gtk_label_set(GTK_LABEL(m_pNextLabel), GetTranslation("Finish"));
        SetButtonStock(m_pNextButton, GTK_STOCK_QUIT);
    }
    else
    {
        gtk_label_set(GTK_LABEL(m_pNextLabel), GetTranslation("Next"));
        SetButtonStock(m_pNextButton, GTK_STOCK_GO_FORWARD);
    }
}
Example #26
0
/* ------------------------------------------------------------- *
 *
 * ------------------------------------------------------------- */
#if 0 /* not used, but leaving it here in case we need it later */
static void i_update_status(TOPLEVEL *toplevel, const char *string)
{
  if (!toplevel->status_label) {
    return;
  }

  if (string) {
    /* NOTE: consider optimizing this if same label */
    gtk_label_set(GTK_LABEL(toplevel->status_label), (char *) string);
  }
}
Example #27
0
/*! \brief Update status bar string 
 *
 *  \par Function Description
 *  This function actually updates the status bar 
 *  widget with the new string.
 *
 *  \param [in] w_current GSCHEM_TOPLEVEL structure
 *  \param [in] string The new string to be shown in the status bar
 */
static void i_update_status(GSCHEM_TOPLEVEL *w_current, const char *string)
{
  if (!w_current->status_label)
    return;

  if (string) {
    /* NOTE: consider optimizing this if same label */
    gtk_label_set(GTK_LABEL(w_current->status_label),
                  (char *) string);
  }
}
Example #28
0
static void TitleEditChanged(GtkWidget *widget,gpointer data)
{
  GripInfo *ginfo;

  ginfo=(GripInfo *)data;

  strcpy(ginfo->ddata.data_title,
         gtk_entry_get_text(GTK_ENTRY(ginfo->gui_info.title_edit_entry)));

  gtk_label_set(GTK_LABEL(ginfo->gui_info.disc_name_label),
                ginfo->ddata.data_title);
}
Example #29
0
static void ArtistEditChanged(GtkWidget *widget,gpointer data)
{
  GripInfo *ginfo;

  ginfo=(GripInfo *)data;

  strcpy(ginfo->ddata.data_artist,
         gtk_entry_get_text(GTK_ENTRY(ginfo->gui_info.artist_edit_entry)));

  gtk_label_set(GTK_LABEL(ginfo->gui_info.disc_artist_label),
                ginfo->ddata.data_artist);
}
Example #30
0
void wxRadioBox::SetString( int item, const wxString& label )
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );

    wxList::compatibility_iterator node = m_boxes.Item( item );

    wxCHECK_RET( node, wxT("radiobox wrong index") );

    GtkLabel *g_label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );

    gtk_label_set( g_label, wxGTK_CONV( label ) );
}