From: <wda...@us...> - 2008-01-13 19:30:15
|
Revision: 2195 http://oorexx.svn.sourceforge.net/oorexx/?rev=2195&view=rev Author: wdashley Date: 2008-01-13 11:30:17 -0800 (Sun, 13 Jan 2008) Log Message: ----------- ArtifactID: None Comment: Added the GtkFixed class. Modified Paths: -------------- sandbox/david/Makefile sandbox/david/Makefile.win sandbox/david/rexxgtk.c sandbox/david/rexxgtk.cls Added Paths: ----------- sandbox/david/grxfixed.c sandbox/david/test3-5.rex Modified: sandbox/david/Makefile =================================================================== --- sandbox/david/Makefile 2008-01-13 17:51:53 UTC (rev 2194) +++ sandbox/david/Makefile 2008-01-13 19:30:17 UTC (rev 2195) @@ -53,7 +53,8 @@ grxbutton.o \ grxpaned.o \ grxtable.o \ - grxentry.o + grxentry.o \ + grxfixed.o # Build the shared library @@ -92,8 +93,11 @@ grxentry.o: grxentry.c rexxgtk.h gcc -c $(GRXCFLAGS) grxentry.c +grxfixed.o: grxfixed.c rexxgtk.h + gcc -c $(GRXCFLAGS) grxfixed.c + clean: rm *.so *.o Modified: sandbox/david/Makefile.win =================================================================== --- sandbox/david/Makefile.win 2008-01-13 17:51:53 UTC (rev 2194) +++ sandbox/david/Makefile.win 2008-01-13 19:30:17 UTC (rev 2195) @@ -106,8 +106,11 @@ grxentry.obj: grxentry.c rexxgtk.h cl -c $(GRXCFLAGS) grxentry.c +grxfixed.obj: grxfixed.c rexxgtk.h + cl -c $(GRXCFLAGS) grxfixed.c + clean: rm *.so *.o Added: sandbox/david/grxfixed.c =================================================================== --- sandbox/david/grxfixed.c (rev 0) +++ sandbox/david/grxfixed.c 2008-01-13 19:30:17 UTC (rev 2195) @@ -0,0 +1,166 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2008 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +/* include the linux headers and our local stuff */ +#include "rexxgtk.h" + + +/*----------------------------------------------------------------------------*/ +/* Global variables */ +/*----------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------*/ +/* Local Definitions */ +/*----------------------------------------------------------------------------*/ + + +/*============================================================================*/ +/* Private Functions */ +/*============================================================================*/ + + +/*============================================================================*/ +/* Public Functions */ +/*============================================================================*/ + + +/*----------------------------------------------------------------------------*/ +/* Rexx External Function: GrxFixedNew */ +/* Description: Create a fixed . */ +/* Rexx Args: None */ +/*----------------------------------------------------------------------------*/ + +APIRET APIENTRY GrxFixedNew(char * Name, size_t Argc, RXSTRING Argv[], + char * Queuename, PRXSTRING Retstr) +{ + GtkWidget *myWidget; + + /* Check for valid arguments */ + if (GrxCheckArgs(0, Argc, Argv)) { + return RXFUNC_BADCALL; + } + + myWidget = gtk_fixed_new(); + + /* Set up the REXX return code */ + sprintf(Retstr->strptr, "%p", myWidget); + Retstr->strlength = strlen(Retstr->strptr); + + return RXFUNC_OK; +} + + +/*----------------------------------------------------------------------------*/ +/* Rexx External Function: GrxFixedPut */ +/* Description: Attach a widget to the fixed. */ +/* Rexx Args: Pointer to the widget */ +/* Pointer to the widget to be fixed */ +/* xpos */ +/* ypos */ +/*----------------------------------------------------------------------------*/ + +APIRET APIENTRY GrxFixedPut(char * Name, size_t Argc, RXSTRING Argv[], + char * Queuename, PRXSTRING Retstr) +{ + GtkWidget *fixedWidget, *myWidget; + gint xpos, ypos; + + /* Check for valid arguments */ + if (GrxCheckArgs(4, Argc, Argv)) { + return RXFUNC_BADCALL; + } + + /* Initialize function parameters */ + sscanf(Argv[0].strptr, "%p", &fixedWidget); + sscanf(Argv[1].strptr, "%p", &myWidget); + sscanf(Argv[2].strptr, "%d", &xpos); + sscanf(Argv[3].strptr, "%d", &ypos); + + if (GTK_IS_WIDGET(GTK_OBJECT(fixedWidget))) { + gtk_fixed_put(GTK_FIXED(fixedWidget), myWidget, xpos, ypos); + } + + /* Set up the REXX return code */ + *(Retstr->strptr) = '0'; + Retstr->strlength = 1; + + return RXFUNC_OK; +} + + +/*----------------------------------------------------------------------------*/ +/* Rexx External Function: GrxFixedMove */ +/* Description: Move a widget in the fixed. */ +/* Rexx Args: Pointer to the widget */ +/* Pointer to the widget to be moved */ +/* xpos */ +/* ypos */ +/*----------------------------------------------------------------------------*/ + +APIRET APIENTRY GrxFixedMove(char * Name, size_t Argc, RXSTRING Argv[], + char * Queuename, PRXSTRING Retstr) +{ + GtkWidget *fixedWidget, *myWidget; + gint xpos, ypos; + + /* Check for valid arguments */ + if (GrxCheckArgs(4, Argc, Argv)) { + return RXFUNC_BADCALL; + } + + /* Initialize function parameters */ + sscanf(Argv[0].strptr, "%p", &fixedWidget); + sscanf(Argv[1].strptr, "%p", &myWidget); + sscanf(Argv[2].strptr, "%d", &xpos); + sscanf(Argv[3].strptr, "%d", &ypos); + + if (GTK_IS_WIDGET(GTK_OBJECT(fixedWidget))) { + gtk_fixed_move(GTK_FIXED(fixedWidget), myWidget, xpos, ypos); + } + + /* Set up the REXX return code */ + *(Retstr->strptr) = '0'; + Retstr->strlength = 1; + + return RXFUNC_OK; +} + Property changes on: sandbox/david/grxfixed.c ___________________________________________________________________ Name: svn:eol-style + native Modified: sandbox/david/rexxgtk.c =================================================================== --- sandbox/david/rexxgtk.c 2008-01-13 17:51:53 UTC (rev 2194) +++ sandbox/david/rexxgtk.c 2008-01-13 19:30:17 UTC (rev 2195) @@ -279,6 +279,10 @@ "GrxTableSetRowSpacings", "GrxTableSetColSpacings", + "GrxFixedNew", + "GrxFixedPut", + "GrxFixedMove", + }; int f; Modified: sandbox/david/rexxgtk.cls =================================================================== --- sandbox/david/rexxgtk.cls 2008-01-13 17:51:53 UTC (rev 2194) +++ sandbox/david/rexxgtk.cls 2008-01-13 19:30:17 UTC (rev 2195) @@ -633,7 +633,19 @@ self~label = label return +/*============================================================================*/ +/* Class: Button_With_Label */ +/*============================================================================*/ +::class GtkButton_With_Label public subclass GtkButton + +::method init +self~init:super +use arg label = '' +self~label = label +return + + /*============================================================================*/ /* Class: Checkbutton */ /*============================================================================*/ @@ -743,7 +755,7 @@ ::method init use strict arg rows, cols, homogeneous -self~pointer =GrxTableNew(rows, cols, homogeneous) +self~pointer = GrxTableNew(rows, cols, homogeneous) return ::method attach @@ -868,3 +880,25 @@ ::method signal_toggle_overwrite return + +/*============================================================================*/ +/* Class: Fixed */ +/*============================================================================*/ + +::class GtkFixed public subclass GtkContainer + +::method init +use strict arg +self~pointer = GrxFixedNew() +return + +::method put +use strict arg widget, xpos, ypos +call GrxFixedPut self~pointer, widget~pointer, xpos, ypos +return + +::method move +use strict arg widget, xpos, ypos +call GrxFixedMove self~pointer, widget~pointer, xpos, ypos +return + Added: sandbox/david/test3-5.rex =================================================================== --- sandbox/david/test3-5.rex (rev 0) +++ sandbox/david/test3-5.rex 2008-01-13 19:30:17 UTC (rev 2195) @@ -0,0 +1,85 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2008 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +-- Derived from Listing 3-5 +-- Foundations of GTK+ Development +-- by Andrew Krause + +window = .myMainWindow~new('GTK_WINDOW_TOPLEVEL') +window~set_title('Fixed') +window~connect_signal("destroy") +window~set_border_width(10) + +fixed = .GtkFixed~new() +button1 = .MyButton~new('Pixed by Pixel ...') +button2 = .MyButton~new('you choose by fate.') + +button1~connect_signal("clicked") +button2~connect_signal("clicked") + +fixed~put(button1, 0, 0) +fixed~put(button2, 20, 30) + +window~add(fixed) +window~show_all() + +call gtk_main + +return + + +::requires 'rexxgtk.cls' + +::class myMainWindow subclass GtkWindow + +::method signal_destroy +.local['GTK_Quit'] = .true +return + +::class MyButton subclass GtkButton_With_Label + +::method signal_clicked +widgetpointer = upper(GrxWidgetGetTopLevel(self~pointer)) +widget = .local['GTK_Database']~at(widgetpointer) +widget~destroy() +return + Property changes on: sandbox/david/test3-5.rex ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |