Antonio,
Estos son los cambios que hice para agregar el nuevo metodo SetAlignment a la clase TSay:
SAY.PRG
Code: Select all | Expand
#include "FiveLinux.ch"
//----------------------------------------------------------------------------//
CLASS TSay FROM TControl
METHOD New( nRow, nCol, oWnd, cText, nWidth, nHeight, lUpdate, oFont,;
lPixel, lDesign, cVarName )
METHOD cGenPrg()
METHOD SetText( cText ) INLINE SaySetText( ::hWnd, cText )
METHOD GetText() INLINE SayGetText( ::hWnd )
METHOD SetJustify( nType ) INLINE SaySetJustify( ::hWnd, nType ) // LEFT = 0, RIGHT = 1, CENTER = 2, FILL = 3
METHOD setangle(nAngle) INLINE SaySetAngle(::hWnd,nAngle)
// Added
METHOD SetAlignment( fHAlign, fVAlign ) INLINE SaySetAlign( ::hWnd, fHAlign, fVAlign )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nRow, nCol, oWnd, cText, nWidth, nHeight, lUpdate, oFont,;
lPixel, lDesign, cVarName ) CLASS TSay
DEFAULT oWnd := GetWndDefault(), nWidth := 70, nHeight := 20,;
lUpdate := .f., lPixel := .F., lDesign := .F.
::hWnd = CreateSay( cText )
::lUpdate = lUpdate
::lDrag = lDesign
::cVarName = cVarName
oWnd:AddControl( Self )
SetParent( ::hWnd, oWnd:hWnd )
::SetPos( nRow * If( lPixel, 1, 10 ), nCol * If( lPixel, 1, 10 ) )
::SetSize( nWidth, nHeight )
if oFont != nil
::SetFont( oFont )
endif
::Link()
::Show()
return Self
//----------------------------------------------------------------------------//
METHOD cGenPrg() CLASS TSay
local cCode := CRLF + " @ " + Str( ::nTop, 3 ) + ", " + ;
Str( ::nLeft, 3 ) + " SAY " + ::cVarName + ;
' PROMPT "' + ::GetText() + '"' + ;
' SIZE ' + Str( ::nWidth, 3 ) + ", " + ;
Str( ::nHeight, 3 ) + " PIXEL OF " + ::oWnd:cVarName + CRLF
return cCode
SAY.C
Code: Select all | Expand
[code]#include <hbapi.h>
#include <gtk/gtk.h>
gboolean button_press_event( GtkWidget * hWnd, GdkEventButton * event );
gboolean motion_notify_event( GtkWidget * hWnd, GdkEventMotion * event );
HB_FUNC( CREATESAY )
{
GtkWidget * hWnd = gtk_label_new( hb_parc( 1 ) );
GtkWidget * event_box = gtk_event_box_new();
gtk_signal_connect( GTK_OBJECT( event_box ), "button_press_event",
( GtkSignalFunc ) button_press_event, NULL );
gtk_signal_connect( GTK_OBJECT( event_box ), "motion_notify_event",
( GtkSignalFunc ) motion_notify_event, NULL );
gtk_widget_set_events( event_box, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK );
gtk_container_add( GTK_CONTAINER( event_box ), hWnd );
gtk_widget_show( hWnd );
hb_retnl( ( HB_ULONG ) event_box );
}
HB_FUNC( SAYSETTEXT )
{
GtkWidget * hWnd = ( GtkWidget * ) hb_parnl( 1 );
GList * children = gtk_container_get_children( ( GtkContainer * ) hWnd );
gtk_label_set_text( children->data, hb_parc( 2 ) );
}
HB_FUNC( SAYGETTEXT )
{
GtkWidget * hWnd = ( GtkWidget * ) hb_parnl( 1 );
GList * children = gtk_container_get_children( ( GtkContainer * ) hWnd );
hb_retc( ( char * ) gtk_label_get_text( children->data ) );
}
HB_FUNC( SAYSETJUSTIFY )
{
GtkWidget * hWnd = ( GtkWidget * ) hb_parnl( 1 );
gtk_label_set_justify( ( GtkLabel * ) hWnd, ( GtkJustification ) hb_parnl( 2 ) );
}
HB_FUNC( SAYSETANGLE )
{
GtkWidget * hWnd = ( GtkWidget * ) hb_parnl( 1 );
GList * children = gtk_container_get_children( ( GtkContainer * ) hWnd );
gtk_label_set_angle( children->data , hb_parnl( 2 ) );
}
// Added
HB_FUNC( SAYSETALIGN )
{
GtkWidget * hWnd = (GtkWidget * ) hb_parnl( 1 );
gtk_misc_set_alignment( ( GtkMisc * ) hWnd, hb_parnd( 2 ), hb_parnd( 3 ) );
}