Page 1 of 1

Modified windows.c window.prg

Posted: Sun Apr 06, 2008 8:37 pm
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)