예제 #1
0
/*
 * Destroy GDISP+ sampled symbol list.
 */
void
gdisp_destroySampledSymbolList ( Kernel_T *kernel )
{

  /*
   * No need to destroy tree specific fonts, because they
   * are destroyed during style destruction.
   */

  /*
   * Destroy tree specific styles.
   */
#if defined(GD_UNREF_THINGS)
  gtk_style_unref(kernel->widgets.selectedNodeStyle);
#endif
  kernel->widgets.selectedNodeStyle = (GtkStyle*)NULL;

#if defined(GD_UNREF_THINGS)
  gtk_style_unref(kernel->widgets.unselectedNodeStyle);
#endif
  kernel->widgets.unselectedNodeStyle = (GtkStyle*)NULL;

  /*
   * Destroy the tree.
   */
  kernel->widgets.expandedNodePixmap  = (Pixmap_T*)NULL;
  kernel->widgets.collapsedNodePixmap = (Pixmap_T*)NULL;
  kernel->widgets.sampledSymbolHTree  = (GtkWidget*)NULL;
 
}
예제 #2
0
파일: ascii.c 프로젝트: dimkr/xchat
void
ascii_open (void)
{
	int do_unref = TRUE;
	int i, j, val;
	unsigned char name[2], num[4];
	GtkWidget *wid, *but, *hbox, *vbox, *win;
	GtkStyle *style;

	style = gtk_style_new ();
	gdk_font_unref (style->font);
	if (menu_sess && menu_sess->type == SESS_DIALOG)
	{
      style->font = dialog_font_normal;
		gdk_font_ref (dialog_font_normal);
	} else
	{
		style->font = font_normal;
		gdk_font_ref (font_normal);
	}

	win = maingui_window ("asciichart", _("Ascii Chart"), TRUE, TRUE, NULL,
									NULL, 0, 0, NULL);
	vbox = wins_get_vbox (win);

	name[1] = 0;

	for (i = 0; i < 16; i++)
	{
		hbox = gtk_hbox_new (0, 0);
		sprintf (num, "%03d", i * 16);
		wid = gtk_label_new (num);
		gtk_widget_set_usize (wid, 36, 20);
		gtk_container_add (GTK_CONTAINER (hbox), wid);
		gtk_widget_show (wid);
		for (j = 0; j < 16; j++)
		{
			val = j + (i * 16);
			name[0] = val;
			but = gtk_button_new_with_label (name);
			gtk_widget_set_style (GTK_BIN (but)->child, style);
			if (do_unref)
			{
				do_unref = FALSE;
				gtk_style_unref (style);
			}
			gtk_signal_connect (GTK_OBJECT (but), "clicked",
					    GTK_SIGNAL_FUNC (ascii_click), GINT_TO_POINTER (val));
			gtk_widget_set_usize (but, 24, 20);
			gtk_container_add (GTK_CONTAINER (hbox), but);
			gtk_widget_show (but);
		}
		gtk_container_add (GTK_CONTAINER (vbox), hbox);
		gtk_widget_show (hbox);
	}

	gtk_widget_show (win);
}
예제 #3
0
/*-----------------------------------------------------------------------------------------------------------------------*/
void Start(GtkWidget *W,gpointer Data)
{
gint i;
GtkWidget *Win,*VBox,*HBox,*Label,*But,*Entry;
static GdkColor Black   = {0,0x0000,0x0000,0x0000};
static GdkColor Magenta = {0,0xFFFF,0x0000,0xFFFF};
static GdkColor Gray   = {0,0x8888,0x8888,0x8888};
static GdkColor Blue  =   {0,0x7777,0x7777,0xFFFF};
GtkStyle *Style1,*Style2,*Style3;
 
if (AcqOn) { Attention(100,"Counting is already started"); return; }

Style1=gtk_style_copy(gtk_widget_get_default_style());                                  //Copy default style to this style
for (i=0;i<5;i++) { Style1->fg[i]=Style1->text[i]=Magenta; Style1->bg[i]=Black; }             //Set colours for all states
Style2=gtk_style_copy(gtk_widget_get_default_style());                             //Copy default style to this style
for (i=0;i<5;i++) { Style2->fg[i]=Style2->text[i]=Black; Style2->bg[i]=Blue; }           //Set colours
Style3=gtk_style_copy(gtk_widget_get_default_style());                                             //Copy default style
for (i=0;i<5;i++) { Style3->fg[i]=Style3->text[i]=Black; Style3->bg[i]=Gray; }                   //Set colours

Win=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_grab_add(Win);                                    //Define a new modal window
gtk_window_set_title(GTK_WINDOW(Win),"Start Counting"); gtk_widget_set_uposition(GTK_WIDGET(Win),300,300);
gtk_widget_set_usize(GTK_WIDGET(Win),245,90); gtk_container_set_border_width(GTK_CONTAINER(Win),10);
VBox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(Win),VBox);                       //VBox for the entire window

HBox=gtk_hbox_new(FALSE,10); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,5);
Label=gtk_label_new("Run Name:"); gtk_box_pack_start(GTK_BOX(HBox),Label,FALSE,FALSE,5);
Entry=gtk_entry_new_with_max_length(35); gtk_box_pack_start(GTK_BOX(HBox),Entry,FALSE,FALSE,0);
SetStyleRecursively(Entry,Style1);
strcpy(RunName,"mydata"); gtk_entry_set_text(GTK_ENTRY(Entry),RunName);
gtk_widget_set_usize(GTK_WIDGET(Entry),130,25);
gtk_signal_connect(GTK_OBJECT(Entry),"changed",GTK_SIGNAL_FUNC(RunNameCallBack),NULL);

HBox=gtk_hbox_new(FALSE,10); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,5);
But=gtk_button_new_with_label("Start"); SetStyleRecursively(But,Style2);
gtk_widget_set_usize(GTK_WIDGET(But),100,25);
gtk_box_pack_start(GTK_BOX(HBox),But,TRUE,FALSE,5);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(StartCallBack),GTK_OBJECT(Win));
But=gtk_button_new_with_label("Cancel"); SetStyleRecursively(But,Style3);
gtk_widget_set_usize(GTK_WIDGET(But),100,25);
gtk_box_pack_start(GTK_BOX(HBox),But,TRUE,FALSE,5);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(CancelCallBack),GTK_OBJECT(Win));
 
gtk_widget_show_all(Win);
gtk_style_unref(Style1); gtk_style_unref(Style2); gtk_style_unref(Style3);
}
예제 #4
0
static void
set_font(GtkWidget *w, GdkFont *font)
{
    GtkStyle *style;
    
    style = gtk_style_copy(gtk_widget_get_style(w));
    gdk_font_unref(style->font);
    gdk_font_ref(font);
    style->font = font;
    gtk_widget_set_style(w, style);
    gtk_style_unref(style);
}
static void
update_row (int               row,
	    XSettingsSetting *setting)
{
  char buffer[256];
  GtkStyle *style;
  const char *type;
  
  if (setting->type != XSETTINGS_TYPE_COLOR)
    gtk_clist_set_cell_style (GTK_CLIST (settings_clist),
			      row, VALUE, NULL);

  switch (setting->type)
    {
    case XSETTINGS_TYPE_INT:
      type = "INT";
      sprintf (buffer, "%d", setting->data.v_int);
      gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, buffer);      
      break;
    case XSETTINGS_TYPE_STRING:
      type = "STRING";
      gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, setting->data.v_string);
      break;
    case XSETTINGS_TYPE_COLOR:
      type = "COLOR";
      gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, "");
      style = gtk_style_copy (settings_clist->style);
      style->base[GTK_STATE_NORMAL].red = setting->data.v_color.red;
      style->base[GTK_STATE_NORMAL].green = setting->data.v_color.green;
      style->base[GTK_STATE_NORMAL].blue = setting->data.v_color.blue;
      style->bg[GTK_STATE_SELECTED].red = setting->data.v_color.red;
      style->bg[GTK_STATE_SELECTED].green = setting->data.v_color.green;
      style->bg[GTK_STATE_SELECTED].blue = setting->data.v_color.blue;
      gtk_clist_set_cell_style (GTK_CLIST (settings_clist),
				row, VALUE, style);
      gtk_style_unref (style);
      break;
    default:
      g_assert_not_reached ();
    }

  gtk_clist_set_text (GTK_CLIST (settings_clist), row, TYPE, type);

  sprintf (buffer, "%ld", setting->last_change_serial);
  gtk_clist_set_text (GTK_CLIST (settings_clist), row, SERIAL, buffer);
}
예제 #6
0
/*-----------------------------------------------------------------------------------------------------------------------*/
int main(int argc,char *argv[])
{
GtkWidget *Win,*VBox,*VBox2,*HBox,*MenuBox,*MenuBar,*But;
gint i;
static GdkColor White = {0,0xFFFF,0xFFFF,0xFFFF};
static GdkColor Red   = {0,0xFFFF,0x0000,0x0000};
static GdkColor Blue  = {0,0x0000,0x0000,0xFFFF};
GtkStyle *RedStyle,*BlueStyle;

g_thread_init(NULL); gdk_threads_init(); gdk_threads_enter();

gtk_init(&argc,&argv); 
AcqOn=FALSE; strcpy(SetupFName,""); StnNo=1; NScalers=4;
for (i=0;i<4;++i) SubA[i]=i;
Interval[0]=1; Interval[1]=5; Interval[2]=60;
Duration[0]=10; Duration[1]=60;

RedStyle=gtk_style_copy(gtk_widget_get_default_style());
for (i=0;i<5;i++) { RedStyle->fg[i]=RedStyle->text[i]=Red; RedStyle->bg[i]=White; }
BlueStyle=gtk_style_copy(gtk_widget_get_default_style());
for (i=0;i<5;i++) { BlueStyle->fg[i]=BlueStyle->text[i]=Blue; BlueStyle->bg[i]=White; }

Win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(Win),"delete_event",GTK_SIGNAL_FUNC(DeleteMain),NULL);
gtk_signal_connect(GTK_OBJECT(Win),"destroy",GTK_SIGNAL_FUNC(DestroyMain),NULL);
gtk_window_set_title(GTK_WINDOW(Win),"SCALER (07 Aug 2009)");
gtk_widget_set_uposition(GTK_WIDGET(Win),100,50);
gtk_widget_set_usize(GTK_WIDGET(Win),845,600);

VBox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(Win),VBox);
MenuBox=gtk_vbox_new(FALSE,1);
gtk_box_pack_start(GTK_BOX(VBox),MenuBox,FALSE,FALSE,0);

GetMainMenu(Win,&MenuBar); 
gtk_box_pack_start(GTK_BOX(MenuBox),MenuBar,FALSE,TRUE,0); 

VBox2=gtk_vbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox),VBox2,FALSE,FALSE,0);
gtk_container_set_border_width(GTK_CONTAINER(VBox2),10);
HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox2),HBox,FALSE,FALSE,0);
S_Start=gtk_label_new("Start:\n"); gtk_box_pack_start(GTK_BOX(HBox),S_Start,FALSE,FALSE,0);
HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox2),HBox,FALSE,FALSE,0);
S_Stop=gtk_label_new("Stop:\n"); gtk_box_pack_start(GTK_BOX(HBox),S_Stop,FALSE,FALSE,0);

HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,0);
But=gtk_button_new_with_label("Elapsed"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
gtk_widget_set_usize(But,56,24);

But=gtk_button_new_with_label("Scaler1"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,40);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Rate1"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,-20);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Scaler2"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,70);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Rate2"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,-50);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Scaler3"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,100);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Rate3"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,-80);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Scaler4"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,135);
gtk_widget_set_usize(But,50,24);

But=gtk_button_new_with_label("Rate4"); SetStyleRecursively(But,BlueStyle);
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,-120);
gtk_widget_set_usize(But,50,24);
 
S_Output=gtk_text_new(NULL,NULL); gtk_widget_set_usize(GTK_WIDGET(S_Output),0,430);
SetStyleRecursively(S_Output,RedStyle);
gtk_box_pack_start(GTK_BOX(VBox),S_Output,FALSE,FALSE,0);
gtk_text_set_word_wrap(GTK_TEXT(S_Output),TRUE); gtk_text_set_editable(GTK_TEXT(S_Output),FALSE);

gtk_widget_show_all(Win);

//gdk_threads_enter(); 
gtk_main(); gdk_threads_leave();
gtk_style_unref(RedStyle); gtk_style_unref(BlueStyle);
return(0);
}
예제 #7
0
파일: open.c 프로젝트: lamps-daq/fera_lamps
/*----------------------------------------------------------------------------------------------------------------------*/
void FileOpenNew(gchar *Title,GtkWidget *Parent,gint X,gint Y,gboolean OpenToRead,gchar *StartPath,gchar *Mask,
                 gboolean MaskEditable,void (*CallBack)(GtkWidget *,gpointer),gboolean Persist)
/* Must have FileX=g_new(struct FileSelectType,1) just before reference to FileOpenNew
   Title=Window title, Parent=Window wrt to which the file browser will be set_transient (keep NULL if not needed)
   X,Y=Window position, OpenToRead=TRUE to open file for read or FALSE to open file for write
   StartPath=initial directory, eg. "." or "/home/lamps/lamps"
   Mask eg. ".ban" (limited to 3 chars); "" will give all files; "d" will give all files ending in 'd'
   MaskEditable=TRUE allows the user to change the Mask
   CallBack=name of callback routine eg. &ReadFile, must g_free(FileX) in this except if Persist=TRUE
   Persist=TRUE keeps the browser open after selection and the "Cancel" button is replaced by "Dismiss" 
           in this case do not g_free(FileX) in CallBack                                                                */
{
GtkWidget *VBox,*HBox,*But,*ScrollW,*Label,*Arrow,*PxW;
#include "Home.xpm"
GdkBitmap *Msk; GdkPixmap *PxMp; GtkStyle *St;
gint i,StatOut;
struct stat StatBuf;
gchar L2Str[LONG_TEXT_FIELD];
static GdkColor Red  = {0,0xFFFF,0x0000,0x0000};
static GdkColor Blue = {0,0x0000,0x0000,0xFFFF};
GtkStyle *RedStyle,*BlueStyle;

RedStyle=gtk_style_copy(gtk_widget_get_default_style());
RedStyle->fg[0]=RedStyle->text[0]=Red;
BlueStyle=gtk_style_copy(gtk_widget_get_default_style());
BlueStyle->fg[0]=BlueStyle->text[0]=Blue;

strcpy(FileX->Mask,Mask); FileX->Index=-1; FileX->N=0;
for (i=0;i<MAX_DIR_ENTRIES;++i) strcpy(FileX->Names[i],""); 

FileX->Win=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_grab_add(FileX->Win);
if (Parent) gtk_window_set_transient_for(GTK_WINDOW(FileX->Win),GTK_WINDOW(Parent));
gtk_window_set_title(GTK_WINDOW(FileX->Win),Title);
gtk_signal_connect(GTK_OBJECT(FileX->Win),"delete_event",GTK_SIGNAL_FUNC(FileOpenDelete),NULL);
gtk_container_set_border_width(GTK_CONTAINER(FileX->Win),10);
gtk_widget_set_usize(GTK_WIDGET(FileX->Win),500,466);
gtk_widget_set_uposition(GTK_WIDGET(FileX->Win),X,Y);
gtk_widget_show(FileX->Win);
St=gtk_widget_get_style(FileX->Win);

VBox=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(FileX->Win),VBox);

HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,10);
if (OpenToRead) Label=gtk_label_new("Look in:"); else Label=gtk_label_new("Save in:");
gtk_box_pack_start(GTK_BOX(HBox),Label,FALSE,FALSE,10);
if (!strcmp(StartPath,".")) getcwd(FileX->Path,LONG_TEXT_FIELD); else strcpy(FileX->Path,StartPath);
StatOut=stat(FileX->Path,&StatBuf);                                  //Check if the supplied StartPath is a valid directory
if (StatOut==-1) getcwd(FileX->Path,LONG_TEXT_FIELD);                                                       //stat in error
else if (!S_ISDIR(StatBuf.st_mode)) getcwd(FileX->Path,LONG_TEXT_FIELD);                                  //Not a directory
FileX->PEntry=gtk_entry_new_with_max_length(LONG_TEXT_FIELD); gtk_entry_set_text(GTK_ENTRY(FileX->PEntry),FileX->Path);
gtk_widget_set_usize(GTK_WIDGET(FileX->PEntry),320,24);
gtk_box_pack_start(GTK_BOX(HBox),FileX->PEntry,FALSE,FALSE,0);
But=gtk_button_new(); gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
Arrow=gtk_arrow_new(GTK_ARROW_UP,GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER(But),Arrow);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(FileOpenUp),NULL);
But=gtk_button_new(); gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(FileOpenHome),NULL);
PxMp=gdk_pixmap_create_from_xpm_d((FileX->Win)->window,&Msk,&St->bg[GTK_STATE_NORMAL],(gchar **)Home_xpm);
PxW=gtk_pixmap_new(PxMp,Msk); gtk_container_add(GTK_CONTAINER(But),PxW);
But=gtk_button_new_with_label("Rescan"); gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(FileOpenReScan),NULL);

ScrollW=gtk_scrolled_window_new(NULL,NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollW),GTK_POLICY_NEVER,GTK_POLICY_ALWAYS);
gtk_box_pack_start(GTK_BOX(VBox),ScrollW,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(ScrollW),0,340);

FileX->Table=gtk_table_new(1,3,FALSE); 
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ScrollW),FileX->Table);
gtk_table_set_row_spacings(GTK_TABLE(FileX->Table),0); gtk_table_set_col_spacings(GTK_TABLE(FileX->Table),0);
DisplayFiles();

HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,10);
Label=gtk_label_new("File Name:"); gtk_box_pack_start(GTK_BOX(HBox),Label,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(Label),100,0);
FileX->FEntry=gtk_entry_new_with_max_length(LONG_TEXT_FIELD); 
gtk_box_pack_start(GTK_BOX(HBox),FileX->FEntry,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(FileX->FEntry),160,0);
gtk_signal_connect(GTK_OBJECT(FileX->FEntry),"changed",GTK_SIGNAL_FUNC(FileChanged),NULL);
FileX->Label1=gtk_label_new(""); gtk_box_pack_start(GTK_BOX(HBox),FileX->Label1,FALSE,FALSE,0);
SetStyleRecursively(FileX->Label1,RedStyle); gtk_widget_set_usize(GTK_WIDGET(FileX->Label1),170,0);
if (OpenToRead) FileX->But=gtk_button_new_with_label("Open"); else FileX->But=gtk_button_new_with_label("Save");
gtk_box_pack_start(GTK_BOX(HBox),FileX->But,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(FileX->But),50,0); gtk_widget_set_sensitive(FileX->But,FALSE);
gtk_signal_connect(GTK_OBJECT(FileX->But),"clicked",GTK_SIGNAL_FUNC(CallBack),NULL);
if (!Persist) gtk_signal_connect_object(GTK_OBJECT(FileX->But),"clicked",GTK_SIGNAL_FUNC(gtk_widget_destroy),
                                        GTK_OBJECT(FileX->Win));

HBox=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(VBox),HBox,FALSE,FALSE,0);
if (OpenToRead) Label=gtk_label_new("Files of type:"); else Label=gtk_label_new("Save as type:");
gtk_box_pack_start(GTK_BOX(HBox),Label,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(Label),100,0);
FileX->MEntry=gtk_entry_new_with_max_length(4); 
gtk_box_pack_start(GTK_BOX(HBox),FileX->MEntry,FALSE,FALSE,0);
gtk_entry_set_text(GTK_ENTRY(FileX->MEntry),Mask); 
gtk_widget_set_usize(GTK_WIDGET(FileX->MEntry),110,0);
if (MaskEditable) gtk_entry_set_editable(GTK_ENTRY(FileX->MEntry),TRUE);
else              gtk_entry_set_editable(GTK_ENTRY(FileX->MEntry),FALSE);
gtk_signal_connect(GTK_OBJECT(FileX->MEntry),"changed",GTK_SIGNAL_FUNC(MaskChanged),NULL);
But=gtk_button_new_with_label("Rescan"); gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
sprintf(L2Str,"%d files found",FileX->Files);
FileX->Label2=gtk_label_new(L2Str); gtk_box_pack_start(GTK_BOX(HBox),FileX->Label2,FALSE,FALSE,0);
gtk_widget_set_usize(GTK_WIDGET(FileX->Label2),170,0);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(FileOpenReScan),NULL);
SetStyleRecursively(FileX->Label2,BlueStyle); gtk_widget_set_usize(GTK_WIDGET(But),50,0);
if (Persist) But=gtk_button_new_with_label("Dismiss"); 
else         But=gtk_button_new_with_label("Cancel"); 
gtk_box_pack_start(GTK_BOX(HBox),But,FALSE,FALSE,0);
gtk_signal_connect(GTK_OBJECT(But),"clicked",GTK_SIGNAL_FUNC(FileOpenCancel),FileX->Win);
gtk_widget_set_usize(GTK_WIDGET(But),50,0);
gtk_widget_show_all(FileX->Win);
gtk_style_unref(RedStyle); gtk_style_unref(BlueStyle);
}
예제 #8
0
파일: about.c 프로젝트: UIKit0/picogui
void
menu_about (GtkWidget * wid, gpointer sess)
{
	GtkWidget *vbox, *label, *hbox;
	GtkStyle *about_style;
	GtkStyle *head_style;
	char buf[512];

	if (about)
	{
		gdk_window_show (about->window);
		return;
	}
	head_style = gtk_style_new ();
#ifndef WIN32
	gdk_font_unref (head_style->font);
	head_style->font = gdk_font_load ("-*-times-bold-i-*-*-*-240-*");
	if (!head_style->font)
		head_style->font = gdk_font_load ("fixed");
#endif
	head_style->fg[GTK_STATE_NORMAL] = colors[2];

	about_style = gtk_style_new ();
	gdk_font_unref (about_style->font);
	about_style->font = gdk_font_load ("fixed");

	about = gtk_window_new (GTK_WINDOW_DIALOG);
	gtk_window_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER);
	gtk_window_set_title (GTK_WINDOW (about), _("About X-Chat"));
	gtk_container_set_border_width (GTK_CONTAINER (about), 6);
	gtk_signal_connect (GTK_OBJECT (about), "destroy",
							  GTK_SIGNAL_FUNC (about_close), 0);
	gtk_widget_realize (about);

	vbox = gtk_vbox_new (0, 2);
	gtk_container_add (GTK_CONTAINER (about), vbox);
	/*gtk_widget_show (vbox);*/

	label = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY (label), FALSE);
	gtk_entry_set_text (GTK_ENTRY (label), "X-Chat " VERSION);
	gtk_widget_set_style (label, head_style);
	gtk_style_unref (head_style);
	gtk_container_add (GTK_CONTAINER (vbox), label);

	snprintf (buf, sizeof (buf),
				 _("(C) 1998-2001 Peter Zelezny <*****@*****.**>\n\n"
				 "An IRC Client for UNIX.\n\n"
				 "This binary was compiled on "__DATE__"\n"
				 "Using GTK %d.%d.%d X %d\n"
				 "Running on %s\n"),
				 gtk_major_version, gtk_minor_version, gtk_micro_version,
#ifdef USE_XLIB
				VendorRelease (GDK_DISPLAY ()), get_cpu_str());
#else
				666, get_cpu_str());
#endif

	label = gtk_label_new (buf);
	gtk_container_add (GTK_CONTAINER (vbox), label);
	gtk_widget_set_style (label, about_style);
	gtk_style_unref (about_style);
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);

	wid = gtk_hseparator_new ();
	gtk_container_add (GTK_CONTAINER (vbox), wid);

	hbox = gtk_hbox_new (0, 2);
	gtk_container_add (GTK_CONTAINER (vbox), hbox);

	wid = gtk_button_new_with_label ("  Continue  ");
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
	GTK_WIDGET_SET_FLAGS (GTK_WIDGET (wid), GTK_CAN_DEFAULT);
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	gtk_widget_grab_default (wid);
	gtk_signal_connect (GTK_OBJECT (wid), "clicked",
							  GTK_SIGNAL_FUNC (gtkutil_destroy), about);

	gtk_widget_show_all (about);
}