Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Module Information
wx
Viewing contents of wx-0.4/README

wxPike README
=============

The original post:
------------------

From comments I made in the mail list.

I'm glad to see I'm not the only one willing to use wxWidgets from Pike. 
I'm uploading my binding as-is currently. It is incomplete, and probably ugly for any experienced module writer, so I accept suggestions.

About this version
------------------

If you tried prior versions, please note you need to make install this one to get it working.

I'm currently using stable a release (2.4.2 for GTK2) in Linux.

At this time it was tested on:

Slackware 9.1 wxWidgets 2.4.2 GTK 2.0 (me)

About previous versions, Martin Bähr reports it doesn't work with 2.5.x series at this time. I won't expect this one work neither, but I'm starting to look for 2.5 compatibilty. Martin also reported success with Debian Sarge and wxWidgets 2.4 GTK.

Also, I still didn't get it working on Windows. To be precise, I didn't be able yet to compile Pike with MinGW, and the precompiled VC Pike is not suitable for compiling. I hope solve some of this soon.

The inner workings
------------------

Most of the binding is generated with bindgen.pike from prototype declarations in a C++ like sui generis syntax, a somewhat it's possible with SWIG. More complex, special cases are in handcoded* files:

handcoded.cc: Main framework (At this time, wxApp and event managing)
handcoded2.cc: Special widget methods.

The generator is basically complete, see TODO for further changes and improvements.

The binding
-----------

At this time there just are a few classes declarations, and even those are incomplete at this time (see the Completion file for details), but adding declarations is easier, as long the generator can handle it by itself.

I aim to provide a more or less complete binding, just leaving out those areas that overlap with those already nicely provided by vanilla Pike, like complex types (wxString, wxArray), database support, etc. If you need or want some of these (or any class/method/whatever lacking at this time) check declarations/syntax.txt for the bindgen input syntax. (and please send me those back!)

All the virtual methods (but weird exceptions) are treated by the binding as such, even when I suspect many of these aren't virtual because of interface but implementation reasons. Anyway you should be able to define subclasses and things should go as expected.

There are a few cases where wxPike method syntax deviates from C++ syntax (generally methods with parameter polimorphism and values returned via pointers), usually I followed wxPython syntax in those cases.

Event message tables are not implemented, and can't be really implemented as are static, but I think can be nicely implemented as a function with an array as a parameter, then doing a foreach() { Connect(); } there. So event definitions could look like:

MyFrame->BEGIN_EVENT_TABLE(
	({ EVT_MENU( ID_Quit, MyFrame->OnQuit),
	   EVT_MENU( ID_About, MyFrame->OnAbout)
	})
);

or:

BEGIN_EVENT_TABLE(MyFrame,
	({ EVT_MENU( ID_Quit, MyFrame->OnQuit),
	   EVT_MENU( ID_About, MyFrame->OnAbout)
	})
);

wxRuby simply add EVT_* methods with message table syntax to be called in the Ruby constructor.
If you are interested in message tables, please tell me what approach like you more. While I'm more interested in using Connect, and therefore this is not in my priorities, I won't be a nice guy if I do not try to provide complete binding.

The example
-----------

The "Hello world" (hworld.pike) example is a translation of http://www.wxwidgets.org/hworld2.txt. Please note that it is meant to be in the same dir as wx.so (.wx syntax).



gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University