HGF GTK support

This commit is contained in:
Antonio Linares
2001-09-03 09:30:03 +00:00
parent 8b21cdaced
commit f460ccac17
9 changed files with 850 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#
# $Id$
#
ROOT = ../../../
C_SOURCES=\
creawin.c \
creamenu.c \
PRG_SOURCES=\
tform.prg \
tmenu.prg \
menuitem.prg \
LIBNAME=hbgtk
include $(TOP)$(ROOT)config/lib.cf

View File

@@ -0,0 +1,137 @@
/*
* $"Id"$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Marek Paliwoda <paliwoda@inetia.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */
#include "harbgtk.h"
/* ********************************************************************* */
#include "shared.ch"
/* ********************************************************************* */
HB_FUNC( HB_GTKCREATEMENUBAR )
{
GtkBox *Box = ( GtkBox * )GUINT_TO_POINTER( hb_parnl( 1 ) );
if( Box )
{
GtkWidget *MenuBar = gtk_menu_bar_new();
gtk_box_pack_start( Box, MenuBar, FALSE, FALSE, 0 );
gtk_box_reorder_child( Box, MenuBar, 0 );
hb_retnl( GPOINTER_TO_UINT( MenuBar ) );
}
else
hb_retnl( GPOINTER_TO_UINT( NULL ) );
}
/* ********************************************************************* */
HB_FUNC( HB_GTKBARADDMENUITEM )
{
GtkMenuBar *Bar = ( GtkMenuBar * )GUINT_TO_POINTER( hb_parnl( 1 ) );
if( Bar )
{
gchar *Caption = ( gchar * )hb_parc( 2 );
/* gint Id = ( gint )hb_parni( 3 ); */
gboolean Enabled = ( gboolean )hb_parl( 4 );
GtkWidget *Item = gtk_menu_item_new_with_label( Caption );
gtk_widget_set_sensitive( Item, Enabled );
gtk_widget_show( Item );
gtk_menu_bar_append( GTK_MENU_BAR( Bar ), Item );
hb_retnl( GPOINTER_TO_UINT( Item ) );
}
else
hb_retnl( GPOINTER_TO_UINT( NULL ) );
}
/* ********************************************************************* */
HB_FUNC( HB_GTKADDMENUITEM )
{
GtkWidget *Menu = ( GtkWidget * )GUINT_TO_POINTER( hb_parnl( 1 ) );
GtkMenuItem *Self = ( GtkMenuItem * )GUINT_TO_POINTER( hb_parnl( 2 ) );
if( !Menu )
{
Menu = gtk_menu_new();
gtk_menu_item_set_submenu( Self, Menu );
hb_stornl( GPOINTER_TO_UINT( Menu ), 1 );
}
if( Self )
{
GtkWidget *Item = ( GtkWidget * )GUINT_TO_POINTER( hb_parnl( 3 ) );
gchar *Caption = ( gchar * )hb_parc( 4 );
/* gint Id = ( gint )hb_parni( 5 ); */
gboolean Enabled = ( gboolean )hb_parl( 6 );
if( !Item )
{
Item = gtk_menu_item_new_with_label( Caption );
gtk_widget_show( Item );
}
gtk_widget_set_sensitive( Item, Enabled );
gtk_menu_append( GTK_MENU( Menu ), Item );
hb_retnl( GPOINTER_TO_UINT( Item ) );
}
else
hb_retnl( GPOINTER_TO_UINT( NULL ) );
}
/* ********************************************************************* */

View File

@@ -0,0 +1,216 @@
/*
* $"Id"$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Marek Paliwoda <paliwoda@inetia.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */
#include "harbgtk.h"
/* ********************************************************************* */
#include "shared.ch"
/* ********************************************************************* */
/* "delete_event" event handler - will be used for VALID clause in the future */
static gint DeleteEventWindowCallback( GtkWidget *Widget, GdkEventAny *Event, gpointer Data )
{
gint DeleteAllowed = FALSE;
/* the code needs to be added here in the future */
return ( DeleteAllowed );
}
/* ********************************************************************* */
/* "destroy" signal handler */
static gint DestroyWindowCallback( GtkWidget *Widget, gpointer Data )
{
gint DestroyAllowed = FALSE;
/* the code needs to be added here in the future */
if( !DestroyAllowed )
{
/* the code needs to be added here in the future */
if( Widget == gtk_widget_get_toplevel( Widget ) )
gtk_main_quit();
}
return ( DestroyAllowed );
}
/* ********************************************************************* */
HB_FUNC( HB_GTKWINDOWCREATE )
{
GtkWidget *MainWin, *VBox, *MoveBar, *MenuBar,
*ScrlWin, *LayoutW, *Current;
GtkTooltips *ToolTip = NULL;
/* for the future enhancements */
gint YSize=400, XSize=500;
MainWin = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_default_size( GTK_WINDOW( MainWin ), XSize, YSize );
gtk_window_set_policy( GTK_WINDOW( MainWin ), TRUE, TRUE, FALSE );
VBox = gtk_vbox_new( FALSE, 1 );
gtk_container_add( GTK_CONTAINER( MainWin ), VBox );
/* for the future enhancements */
Current = VBox;
LayoutW = gtk_layout_new( NULL, NULL );
gtk_layout_set_size( GTK_LAYOUT( LayoutW ), XSize, YSize );
gtk_box_pack_start( GTK_BOX( Current ), LayoutW, TRUE, TRUE, 0 );
/* for the future signal handling */
gtk_signal_connect
(
GTK_OBJECT( MainWin ),
"delete_event",
GTK_SIGNAL_FUNC( ( GtkSignalFunc ) DeleteEventWindowCallback ),
( gpointer ) NULL
);
/* for the future signal handling */
gtk_signal_connect
(
GTK_OBJECT( MainWin ),
"destroy",
GTK_SIGNAL_FUNC( ( GtkSignalFunc ) DestroyWindowCallback ),
( gpointer ) NULL
);
/* for the future enhancements */
ScrlWin = MoveBar = MenuBar = NULL;
{
PHB_ITEM ReturnArray, ArrayItem;
ReturnArray = hb_itemArrayNew( 7 );
ArrayItem = hb_itemNew( NULL );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( MainWin ) );
hb_itemArrayPut( ReturnArray, 1, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( VBox ) );
hb_itemArrayPut( ReturnArray, 2, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( ScrlWin ) );
hb_itemArrayPut( ReturnArray, 3, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( LayoutW ) );
hb_itemArrayPut( ReturnArray, 4, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( MoveBar ) );
hb_itemArrayPut( ReturnArray, 5, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( MenuBar ) );
hb_itemArrayPut( ReturnArray, 6, ArrayItem );
hb_itemPutNL( ArrayItem, GPOINTER_TO_UINT( ToolTip ) );
hb_itemArrayPut( ReturnArray, 7, ArrayItem );
hb_itemReturn( ReturnArray );
hb_itemRelease( ReturnArray );
hb_itemRelease( ArrayItem );
}
}
/* ********************************************************************* */
HB_FUNC( HB_GTKWINGETTEXT )
{
PHB_ITEM hWnd = hb_param( 1, HB_IT_ARRAY );
if( hWnd )
{
GtkWindow *Win = ( GtkWindow * )GUINT_TO_POINTER( hb_arrayGetNL( hWnd, 1 ) );
hb_retc( ( char * )Win->title );
}
else
hb_retc( "" );
}
/* ********************************************************************* */
HB_FUNC( HB_GTKWINSETTEXT )
{
PHB_ITEM hWnd = hb_param( 1, HB_IT_ARRAY );
if( hWnd )
{
gchar *Title = hb_parc( 2 ); /* either tilte or "" */
GtkWindow *Win = ( GtkWindow * )GUINT_TO_POINTER( hb_arrayGetNL( hWnd, 1 ) );
gtk_window_set_title( Win, Title );
}
}
/* ********************************************************************* */
HB_FUNC( HB_GTKSHOWMODAL )
{
PHB_ITEM hWnd = hb_param( 1, HB_IT_ARRAY );
if( hWnd )
{
GtkWidget *Win = ( GtkWidget * )GUINT_TO_POINTER( hb_arrayGetNL( hWnd, 1 ) );
gtk_widget_show_all( Win );
/* NOTE : this does not make any sense. It is only an example */
gtk_main();
}
}
/* ********************************************************************* */

View File

@@ -0,0 +1,53 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Marek Paliwoda <paliwoda@inetia.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */

View File

@@ -0,0 +1,75 @@
/*
* $"Id"$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Marek Paliwoda <paliwoda@inetia.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ************************************************************************* */
#include <glib.h>
#include <gtk/gtk.h>
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbstack.h>
#include <hbvm.h>
#include "shared.ch"
/* ************************************************************************* */
/* default MultiLine delimiters - they allow to divide */
/* single string into MultiLine string by putting these */
/* delimiters into it */
extern gchar *MultiLineDelimiters;
/* a general Tooltips holder */
extern GtkTooltips *MainTooltips;
/* ************************************************************************* */

View File

@@ -0,0 +1,105 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Antonio Linares <alinares@fivetech.com>
* Copyright 2001 Maurilio Longo <maurilio.longo@libero.it>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */
#include "common.ch"
#include "hbclass.ch"
/* ********************************************************************* */
CLASS TMenuItem
DATA cCaption INIT "" // Specifies the text of the menu item
DATA cAction INIT "" // A character description of the method to invoke
DATA nId // Command value to send to the container form
DATA lEnabled INIT .T. // Specifies whether the menu item is enabled
DATA aItems INIT {} // Contains the menu items in the submenu of the menu item
DATA oParent // Identifies the parent menu item of this menu item
DATA nHandle INIT 0 // The handle of the submenu of this menu item
DATA hMenuItem INIT 0 // The handle of this menu item
CLASSDATA nIdStart INIT 110 // start value for commands value to assign to menu items
METHOD New( oOwner ) // Creates a new menu item
METHOD Add( oMenuItem ) // Adds a new drop down menu item
ENDCLASS
/* ********************************************************************* */
METHOD New( oOwner ) CLASS TMenuItem
::nId := ::nIdStart++
::oParent := oOwner
// NOTE : physical creation is delayed until MenuItem is added to a parent
RETURN Self
/* ********************************************************************* */
METHOD Add( oMenuItem ) CLASS TMenuItem
/* required because of a stupid Harbour compiler error */
LOCAL nHandle := ::nHandle
oMenuItem:hMenuItem := hb_GtkAddMenuItem( @nHandle, ::hMenuItem, ;
oMenuItem:hMenuItem, oMenuItem:cCaption, oMenuItem:nId, ;
oMenuItem:lEnabled )
::nHandle := nHandle
AAdd( ::aItems, oMenuItem )
RETURN nil
/* ********************************************************************* */

View File

@@ -0,0 +1,54 @@
/*
* $"Id"$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Marek Paliwoda <paliwoda@inetia.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ************************************************************************* */

View File

@@ -0,0 +1,102 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Antonio Linares <alinares@fivetech.com>
* Copyright 2001 Maurilio Longo <maurilio.longo@libero.it>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */
#include "common.ch"
#include "hbclass.ch"
#include "harbgtk.ch"
/* ********************************************************************* */
CLASS TForm
DATA hWnd
DATA oMainMenu
CLASSDATA lRegistered INIT .T.
METHOD New()
METHOD ShowModal()
ACCESS cCaption() INLINE hb_GtkWinGetText( ::hWnd )
ASSIGN cCaption( cNewCaption ) INLINE ;
hb_GtkWinSetText( ::hWnd, cNewCaption )
ACCESS oMenu() INLINE ::oMainMenu
ASSIGN oMenu( oNewMenu )
ENDCLASS
/* ********************************************************************* */
METHOD New() CLASS TForm
// Again this code may be moved to a method Create() to hide the
// OS API details
::hWnd := hb_GtkWindowCreate()
RETURN Self
/* ********************************************************************* */
METHOD ShowModal() CLASS TForm
hb_GtkShowModal( ::hWnd )
RETURN nil
/* ********************************************************************* */
ASSIGN oMenu( oNewMenu ) CLASS TForm
::oMainMenu = oNewMenu
RETURN nil
/* ********************************************************************* */

View File

@@ -0,0 +1,89 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Harbour GUI framework for Gtk
*
* Copyright 2001 Antonio Linares <alinares@fivetech.com>
* Copyright 2001 Maurilio Longo <maurilio.longo@libero.it>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* ********************************************************************* */
#include "hbclass.ch"
/* ********************************************************************* */
CLASS TMenu
DATA nHandle
DATA aItems
METHOD New( oForm )
METHOD Add( oMenuItem )
ENDCLASS
/* ********************************************************************* */
METHOD New( oForm ) CLASS TMenu
::aItems := {}
::nHandle := hb_GtkCreateMenuBar( oForm:hWnd[ 2 ] )
oForm:hWnd[ 6 ] := ::nHandle
oForm:omenu := Self
RETURN Self
/* ********************************************************************* */
METHOD Add( oMenuItem ) CLASS TMenu
oMenuItem:hMenuItem := hb_GtkBarAddMenuItem( ::nHandle, ;
oMenuItem:cCaption, oMenuItem:nId, oMenuItem:lEnabled )
AAdd( ::aItems, oMenuItem )
RETURN nil
/* ********************************************************************* */