Modified windows.c window.prg

Post Reply
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Modified windows.c window.prg

Post by xProgrammer »

Hi Antonio

I have made the following additions

windows.c

Code: Select all

HB_FUNC( GTKSETFGCOLOR )
{
   GdkColor color;

   gdk_color_parse( hb_parc( 2 ), &color );
   gtk_widget_modify_fg( ( GtkWidget * ) hb_parnl( 1 ), hb_parni( 3 ), &color );
}
HB_FUNC( GTKSETBGCOLOR )
{
   GdkColor color;

   gdk_color_parse( hb_parc( 2 ), &color );
   gtk_widget_modify_bg( ( GtkWidget * ) hb_parnl( 1 ), hb_parni( 3 ), &color );
}
HB_FUNC( GTKSETTEXTCOLOR )
{
   GdkColor color;

   gdk_color_parse( hb_parc( 2 ), &color );
   gtk_widget_modify_text( ( GtkWidget * ) hb_parnl( 1 ), hb_parni( 3 ), &color );
}
HB_FUNC( GTKSETBASECOLOR )
{
   GdkColor color;

   gdk_color_parse( hb_parc( 2 ), &color );
   gtk_widget_modify_base( ( GtkWidget * ) hb_parnl( 1 ), hb_parni( 3 ), &color );
}
HB_FUNC( GTKRCPARSESTRING )
{
   gtk_rc_parse_string( hb_parc( 1 ) );
}
and in window.prg

Code: Select all

   METHOD SetBackgroundColor( sCol, iState ) INLINE GtkSetBGColor( ::hWnd, sCol, iState )
   METHOD SetForegroundColor( sCol, iState ) INLINE GtkSetFGColor( ::hWnd, sCol, iState )
   METHOD SetTextColor( sCol, iState ) INLINE GtkSetTextColor( ::hWnd, sCol, iState )
   METHOD SetBaseColor( sCol, iState ) INLINE GtkSetBaseColor( ::hWnd, sCol, iState )
   METHOD SetEntrySelection( lSel ) INLINE GtkRCParseString( IF( lSel, "gtk-entry-select-on-focus = 1", "gtk-entry-select-on-focus = 0" ) )
The above changes give you control over the color of any window/dialog/control. Also includes the no entry-no-selection-on-entry option in a form that you can turn it on or off and with the underlying C code ready if we need to parse other strings. Whilst it doesn't have to be in any particular class, putting it in TWindow class makes it available in all the FiveLinux gui classes via inheritance.

Regards
Doug
(xProgrammer)
Post Reply