[Mplayer-cvslog] CVS: main/Gui/mplayer/gtk common.c,NONE,1.1 common.h,NONE,1.1

Zoltan Ponekker pontscho at mplayerhq.hu
Tue Nov 12 22:51:28 CET 2002


Update of /cvsroot/mplayer/main/Gui/mplayer/gtk
In directory mail:/var/tmp.root/cvs-serv9911/Gui/mplayer/gtk

Added Files:
	common.c common.h 
Log Message:
new entry

--- NEW FILE ---

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

GtkWidget * AddFrame( char * title,int type,GtkWidget * parent,int add )
{
 GtkWidget * frame = NULL;
 frame=gtk_frame_new( title );
 gtk_widget_set_name( frame,"frame" );
 gtk_widget_ref( frame );
 gtk_widget_show( frame );
 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame );
  else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 );
 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
 return frame;
}

GtkWidget * AddLabel( char * title,GtkWidget * parent )
{
 GtkWidget * label;
 label=gtk_label_new( title );
 gtk_widget_set_name( label,"label" );
 gtk_widget_show( label );
 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
 gtk_misc_set_padding( GTK_MISC( label ),4,0 );
 return label;
}

GtkWidget * AddVBox( GtkWidget * parent )
{
 GtkWidget * vbox;
 vbox=gtk_vbox_new( FALSE,0 );
 gtk_widget_set_name( vbox,"vbox" );
 gtk_widget_ref( vbox );
 gtk_widget_show( vbox );
 gtk_container_add( GTK_CONTAINER( parent ),vbox );
 return vbox;
}

GtkWidget * AddHBox( GtkWidget * parent,int type )
{
 GtkWidget * hbox;
 hbox=gtk_hbox_new( FALSE,0 );
 gtk_widget_set_name( hbox,"hbox" );
 gtk_widget_ref( hbox );
 gtk_widget_show( hbox );
 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 );
  else gtk_container_add( GTK_CONTAINER( parent ),hbox );
 return hbox;
}

GtkWidget * AddCheckButton( char * title, GtkWidget * parent )
{
 GtkWidget * CB;
 CB=gtk_check_button_new_with_label( title );
 gtk_widget_set_name( CB,"CB" );
 gtk_widget_ref( CB );
 gtk_widget_show( CB );
 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 );
 return CB;
}

GtkWidget * AddRadioButton( char * title,GSList ** group,GtkWidget * parent )
{
 GtkWidget * RB;
 RB=gtk_radio_button_new_with_label( *group,title );
 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) );
 gtk_widget_set_name( RB,"RB" );
 gtk_widget_ref( RB );
 gtk_widget_show( RB );
 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 );
 return RB;
}

GtkWidget * AddButton( char * title,GtkWidget * parent )
{
 GtkWidget * B;
 B=gtk_button_new_with_label( title );
 gtk_widget_set_name( B,"B" );
 gtk_widget_ref( B );
 gtk_widget_show( B );
 gtk_container_add( GTK_CONTAINER( parent ),B );
 return B;
}

GtkWidget * AddHSeparator( GtkWidget * parent )
{
 GtkWidget * hseparator;
 hseparator=gtk_hseparator_new();
 gtk_widget_set_name( hseparator,"hseparator1" );
 gtk_widget_ref( hseparator );
 gtk_widget_show( hseparator );
 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 );
 gtk_widget_set_usize( hseparator,-2,6 );
 return hseparator;
}

GtkWidget * AddHButtonBox( GtkWidget * parent )
{
 GtkWidget * hbuttonbox;
 hbuttonbox=gtk_hbutton_box_new();
 gtk_widget_set_name( hbuttonbox,"hbuttonbox" );
 gtk_widget_ref( hbuttonbox );
 gtk_widget_show( hbuttonbox );
 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 );
 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 );
 return hbuttonbox;
}

GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
{
 GtkWidget * HS;
 HS=gtk_hscale_new( adj );
 gtk_widget_set_name( HS,"HS" );
 gtk_widget_ref( HS );
 gtk_widget_show( HS );
 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 );
 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT );
 gtk_scale_set_digits( GTK_SCALE( HS ),digit );
 return HS;
}

--- NEW FILE ---

#ifndef __COMMON_H
#define __COMMON_H

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

extern GtkWidget * AddFrame( char * title,int type,GtkWidget * parent,int add );
extern GtkWidget * AddLabel( char * title,GtkWidget * parent );
extern GtkWidget * AddVBox( GtkWidget * parent );
extern GtkWidget * AddHBox( GtkWidget * parent,int type );
extern GtkWidget * AddCheckButton( char * title, GtkWidget * parent );
extern GtkWidget * AddRadioButton( char * title,GSList ** group,GtkWidget * parent );
extern GtkWidget * AddButton( char * title,GtkWidget * parent );
extern GtkWidget * AddHSeparator( GtkWidget * parent );
extern GtkWidget * AddHButtonBox( GtkWidget * parent );
extern GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit );

#endif




More information about the MPlayer-cvslog mailing list