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/hworld.pike

#!/usr/bin/env pike
/*
   wxPike - (c) 2005 Julio César Gázquez
   
   hworld.pike
   Hello world sample by Julio Gazquez
   Based on hworld.cpp by Robert Roebling

*/

enum
{
    ID_Quit = 1,
    ID_About,
};

class MyApp
{
	inherit wx.App;

	int OnInit()
	{
		MyFrame frame = MyFrame( "Hello World", wx.Point(50,50), wx.Size(450,340) );

		frame->Connect( ID_Quit, wx.EVT_COMMAND_MENU_SELECTED,
		frame->OnQuit, frame);
		frame->Connect( ID_About, wx.EVT_COMMAND_MENU_SELECTED,
		frame->OnAbout, frame);

		frame->Show(wx.TRUE);
		SetTopWindow(frame);
	
		return 1; 
	}
};

class MyFrame
{
	inherit wx.Frame;

	void create(string title, wx.Point pos, wx.Size size)
	{
		Frame::create(0, -1, title, pos, size);

		// create menubar
		wx.MenuBar menuBar = wx.MenuBar();
		// create menu
 		wx.Menu menuFile = wx.Menu();
		// append menu entries
		menuFile->Append( ID_About, "&About...");
		menuFile->AppendSeparator();
		menuFile->Append( ID_Quit, "E&xit");
		// append menu to menubar
 		menuBar->Append( menuFile, "&File" );
		// set frame menubar
		SetMenuBar( menuBar ); 

		// create frame statusbar
		CreateStatusBar();
		// set statusbar text
		SetStatusText( "Welcome to wxWindows!");
		
	}

	void OnQuit(wx.Event event)
	{
		Close(wx.TRUE);
	}

	void OnAbout(wx.Event event)
	{
		mixed x=MessageBox("This is a wxPike Hello world sample",
    		    "About Hello World", wx.OK | wx.ICON_INFORMATION, this_object(),0,0); 
	}

};

int main()
{
	return implement_app(MyApp());
}


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