Re: [wxhaskell-devel] wxGraphicsRenderer
I tried this so far which is copied from the basic Paint.hs from the sample. - it compiles , run and break at run time if I omit Line [1] gr <- graphicsContextCreate dc -- 1. this break for now and it does not compile when I leave it on. My sources are [1] and [2] [1]: http://docs.wxwidgets.org/trunk/classwx_graphics_context.html [2]: http://chandlerproject.org/Projects/WxPythonGraphicsContext Ill keep you posted -- module Main where import Graphics.UI.WXCore import Graphics.UI.WX main :: IO () main = start gui gui :: IO () gui = do f <- frame [text := "Paint demo", fullRepaintOnResize := False] sw <- scrolledWindow f [ on paint := onpaint , virtualSize := sz 500 500, scrollRate := sz 10 10 , fullRepaintOnResize := False] set f [clientSize := sz 150 150, layout := fill $ widget sw] return () where onpaint dc viewArea = do gr <- graphicsContextCreate dc -- 1. this break for now pa <-graphicsPathCreate graphicsPathAddCircle pa (pt 30 30) 20 graphicsPathCloseSubpath pa --circle dc (pt 30 30) 20 [penKind := PenSolid] Paint.hs:13:45: Couldn't match expected type `()' with actual type `CWindowDC a0' Expected type: DC () -> Rect -> IO () Actual type: WindowDC a0 -> t0 -> IO () In the second argument of `(:=)', namely `onpaint' In the expression: on paint := on paint void MyCanvas::OnPaint(wxPaintEvent (http://docs.wxwidgets.org/trunk/classwx_paint_event.html) &event) { // Create paint DC wxPaintDC (http://docs.wxwidgets.org/trunk/classwx_paint_d_c.html) dc(this); // Create graphics context from it wxGraphicsContext (http://docs.wxwidgets.org/trunk/classwx_graphics_context.html) *gc = wxGraphicsContext::Create (http://docs.wxwidgets.org/trunk/classwx_graphics_context.html#adbc3ec3262f53e209276293ff1c0944e)( dc ); if (gc) { // make a path that contains a circle and some lines gc->SetPen (http://docs.wxwidgets.org/trunk/classwx_graphics_context.html#ac34d6320c2777fe2afcf8777868e37d3)( *wxRED_PEN (http://docs.wxwidgets.org/trunk/pen_8h.html#a62930a76d6d75371553b90661f8d9d30) ); wxGraphicsPath (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html) path = gc->CreatePath (http://docs.wxwidgets.org/trunk/classwx_graphics_context.html#a55c95ed392ed17f6fbd6e83b2a442a80)(); path.AddCircle (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#a1dedee16234c079524b51db8e0395f68)( 50.0, 50.0, 50.0 ); path.MoveToPoint (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#a62c899479b6bd2105507317a1246978e)(0.0, 50.0); path.AddLineToPoint (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#abd69d09ad6fe10af99a675ac79d2717a)(100.0, 50.0); path.MoveToPoint (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#a62c899479b6bd2105507317a1246978e)(50.0, 0.0); path.AddLineToPoint (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#abd69d09ad6fe10af99a675ac79d2717a)(50.0, 100.0 ); path.CloseSubpath (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#a93ee08b5acd2a2aa82dceb4bbd9cc819)(); path.AddRectangle (http://docs.wxwidgets.org/trunk/classwx_graphics_path.html#ac257fef3393f29b2705438fdc08b28a0)(25.0, 25.0, 50.0, 50.0); gc->StrokePath (http://docs.wxwidgets.org/trunk/classwx_graphics_context.html#a4f7f8f768e84dcdf50493f0e7ef0c00a)(path); delete gc; } } -- Luc be.linkedin.com/in/luctaesch/ (http://be.linkedin.com/in/luctaesch/) Envoyé avec Sparrow (http://www.sparrowmailapp.com/?sig) Le lundi 25 mars 2013 à 22:52, Henk-Jan van Tuyl a écrit : > On Mon, 25 Mar 2013 19:00:58 +0100, Luc TAESCH (mailto:luc.tae...@gmail.com)> > wrote: > > > ah many thanks ! I understand better now ( change quite a bit since > > 2003 :-) > > I indeed can see the classes . > > > > are these new renderers already mapped into wx, or should we use them as > > such , directly ? > > any sample / test available , out of chance ? > > > > Many thanks for your patience, anyway :-) > > > > Luc > > I can't find any renderer functions in wx, or any samples/tests; I suppose > the best thing to do is to try to translate C++ sample programs to Haskell. > > Regards, > Henk-Jan van Tuyl > > > -- > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > > -- Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___ wxhaskell-devel mailing list wxhaskell-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-deve
Re: [wxhaskell-devel] wxGraphicsRenderer
On Mon, 25 Mar 2013 19:00:58 +0100, Luc TAESCH wrote: > ah many thanks ! I understand better now ( change quite a bit since > 2003 :-) > I indeed can see the classes . > > are these new renderers already mapped into wx, or should we use them as > such , directly ? > any sample / test available , out of chance ? > > Many thanks for your patience, anyway :-) > > Luc I can't find any renderer functions in wx, or any samples/tests; I suppose the best thing to do is to try to translate C++ sample programs to Haskell. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- -- Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ wxhaskell-devel mailing list wxhaskell-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel
Re: [wxhaskell-devel] wxGraphicsRenderer
ah many thanks ! I understand better now ( change quite a bit since 2003 :-) I indeed can see the classes . are these new renderers already mapped into wx, or should we use them as such , directly ? any sample / test available , out of chance ? Many thanks for your patience, anyway :-) Luc -- Luc be.linkedin.com/in/luctaesch/ (http://be.linkedin.com/in/luctaesch/) Envoyé avec Sparrow (http://www.sparrowmailapp.com/?sig) Le lundi 25 mars 2013 à 17:07, Henk-Jan van Tuyl a écrit : > On Mon, 25 Mar 2013 10:16:00 +0100, Luc TAESCH (mailto:luc.tae...@gmail.com)> > wrote: > > > -many thanks for your help, this made my day ! > > > > … but just for 10 mn as I cannot find these on the current 0.90.3. ;-< ?? > > > > I see you are pointing to an old lib, 0.12.7. Currently I cannot find > > the Graphics-UI-WXCore-WxcClassesAL > > (http://hackage.haskell.org/packages/archive/wxcore/0.12.1.7/doc/html/Graphics-UI-WXCore-WxcClassesAL.html#g:81) > > > > file, nor any containing GraphicsRenderer > > > > I guess there have been some refactoring since 0.12.7. > > > > could you help pointing at the files ? > > > > or am i getting the wrong source ? > > I got the source from > > [https://github.com/atzedijkstra/wxHaskell/tree/master/wxcore/src/haskell/Graphics/UI/WXCore] > > > > > The functions you are looking for, are defined in file > wxcore\src\haskell\Graphics\UI\WXCore\WxcClassesAL.hs > . This file is automatically created when you run > cabal install > or > runhaskell Setup configure > runhaskell Setup build > inside the wxcore directory. Note, that you first have to install wxdirect > and wxc > > You only need to import Graphics.UI.WXCore to get the wanted functionality. > > Regards, > Henk-Jan van Tuyl > > > -- > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > > -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar___ wxhaskell-devel mailing list wxhaskell-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel
Re: [wxhaskell-devel] wxGraphicsRenderer
On Mon, 25 Mar 2013 10:16:00 +0100, Luc TAESCH wrote: > -many thanks for your help, this made my day ! > > … but just for 10 mn as I cannot find these on the current 0.90.3. ;-< ?? > > I see you are pointing to an old lib, 0.12.7. Currently I cannot find > the Graphics-UI-WXCore-WxcClassesAL > (http://hackage.haskell.org/packages/archive/wxcore/0.12.1.7/doc/html/Graphics-UI-WXCore-WxcClassesAL.html#g:81) > > file, nor any containing GraphicsRenderer > > I guess there have been some refactoring since 0.12.7. > > could you help pointing at the files ? > > or am i getting the wrong source ? > I got the source from > [https://github.com/atzedijkstra/wxHaskell/tree/master/wxcore/src/haskell/Graphics/UI/WXCore] The functions you are looking for, are defined in file wxcore\src\haskell\Graphics\UI\WXCore\WxcClassesAL.hs . This file is automatically created when you run cabal install or runhaskell Setup configure runhaskell Setup build inside the wxcore directory. Note, that you first have to install wxdirect and wxc You only need to import Graphics.UI.WXCore to get the wanted functionality. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ wxhaskell-devel mailing list wxhaskell-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel