dotgnu-libs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-libs-commits] CVS: xsharp/samples Scribble.cs,NONE,1.1 Makefile.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-libs-commits] CVS: xsharp/samples Scribble.cs,NONE,1.1 Makefile.am,1.1.1.1,1.2 XHello.cs,1.2,1.3 samples.build,1.1.1.1,1.2 samples.nant,1.1,1.2
Date: Fri, 27 Sep 2002 23:01:03 -0400

Update of /cvsroot/dotgnu-libs/xsharp/samples
In directory subversions:/tmp/cvs-serv19182/samples

Modified Files:
        Makefile.am XHello.cs samples.build samples.nant 
Added Files:
        Scribble.cs 
Log Message:


Implement pointer motion events; add the "Scribble" sample.


--- NEW FILE ---
/*
 * Scribble.cs - Sample drawing program for X#.
 *
 * This file is part of the X# library.
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

using System;
using XWindows;

public class Scribble
{
        // Internal state.
        private static bool drawing;
        private static int lastX, lastY;

        // Main entry point.
        public static void Main()
        {
                Display dpy = Display.Open(null);
                Widget root = dpy.DefaultRootWindow;
                TopLevelWindow topLevel = new TopLevelWindow("Scribble", 300, 
250);
                topLevel.SelectPress += new ButtonPressEventHandler(Press);
                topLevel.SelectRelease += new 
ButtonReleaseEventHandler(Release);
                topLevel.PointerMotion += new PointerMotionEventHandler(Motion);
                topLevel.Foreground = new Color(0x00, 0x00, 0x00);
                topLevel.Background = new Color(0xFF, 0xFF, 0xFF);
                topLevel.Map();
                dpy.Flush();
                dpy.Run();
                dpy.Close();
        }

        // Handle mouse press on "Select".
        public static void Press(Widget widget, int x, int y,
                                                         ButtonName button, 
ModifierMask modifiers)
        {
                drawing = true;
                lastX = x;
                lastY = y;
        }

        // Handle mouse release on "Select".
        public static void Release(Widget widget, int x, int y,
                                                           ButtonName button, 
ModifierMask modifiers)
        {
                if(drawing)
                {
                        Canvas canvas = new Canvas(widget);
                        canvas.DrawLine(lastX, lastY, x, y);
                        canvas.Dispose();
                        drawing = false;
                }
        }

        // Handle mouse pointer motion.
        public static void Motion(Widget widget, int x, int y,
                                                          ModifierMask 
modifiers)
        {
                if(drawing)
                {
                        Canvas canvas = new Canvas(widget);
                        canvas.DrawLine(lastX, lastY, x, y);
                        canvas.Dispose();
                        lastX = x;
                        lastY = y;
                }
        }

} // class Scribble

Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/samples/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Makefile.am 26 Sep 2002 10:32:46 -0000      1.1.1.1
--- Makefile.am 28 Sep 2002 03:01:00 -0000      1.2
***************
*** 5,7 ****
                        -f "$(srcdir)/samples.build" all
  
! CLEANFILES = XHello.exe
--- 5,7 ----
                        -f "$(srcdir)/samples.build" all
  
! CLEANFILES = XHello.exe Scribble.exe

Index: XHello.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/samples/XHello.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** XHello.cs   27 Sep 2002 12:55:43 -0000      1.2
--- XHello.cs   28 Sep 2002 03:01:00 -0000      1.3
***************
*** 21,25 ****
  
  using System;
- using System.Threading;
  using XWindows;
  
--- 21,24 ----

Index: samples.build
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/samples/samples.build,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** samples.build       26 Sep 2002 10:32:46 -0000      1.1.1.1
--- samples.build       28 Sep 2002 03:01:00 -0000      1.2
***************
*** 20,23 ****
--- 20,40 ----
                </compile>
  
+               <!-- Build the Scribble.exe program -->
+               <compile output="Scribble.exe"
+                                target="exe"
+                                optimize="true"
+                                debug="true"
+                                sanewarnings="true">
+ 
+                       <sources>
+                               <file name="Scribble.cs"/>
+                       </sources>
+ 
+                       <references>
+                               <file name="../Xsharp/Xsharp.dll"/>
+                       </references>
+ 
+               </compile>
+ 
        </target>
  </project>

Index: samples.nant
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/samples/samples.nant,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** samples.nant        27 Sep 2002 01:38:41 -0000      1.1
--- samples.nant        28 Sep 2002 03:01:00 -0000      1.2
***************
*** 22,25 ****
--- 22,44 ----
                </mcs>
  
+               <!-- Build the Scribble.exe program -->
+               <mcs output="Scribble.exe"
+                        target="exe"
+                        optimize="true"
+                        debug="true"
+                        sanewarnings="true">
+ 
+                       <arg value="/r:Xsharp.dll"/>
+ 
+                       <sources>
+                               <includes name="Scribble.cs"/>
+                       </sources>
+ 
+                       <references>
+                               <file name="../Xsharp/Xsharp.dll"/>
+                       </references>
+ 
+               </mcs>
+ 
        </target>
  </project>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]