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


class MenuApp
{
	inherit .wx.App;
	
	int OnInit()
	{
		MenuFrame mainMenu=MenuFrame("Main Menu",
			([ "Office":([ 
				"WordProcessor":0,
				"Spreadsheet":0]),
			"Network":0, 
			"Util":0 ]) );
		mainMenu->Show(.wx.TRUE);
		SetTopWindow(mainMenu);
	}
}

.wx.Point DefaultPosition=.wx.Point(100,100);
.wx.Size DefaultSize=.wx.Size(100,200);

class MenuFrame
{
	inherit .wx.Frame;
	array(mixed) itemActions; 
	void create(string title, mapping(string:mixed) items)
	{
		::create(0,-1,title);
		
		itemActions = allocate(sizeof(items));
		
		.wx.BoxSizer sizer=.wx.BoxSizer(.wx.VERTICAL);
		SetSizer(sizer);
		
		.wx.Button b=.wx.Button(this_object(), -1, title);
		sizer->Add(b);
		
		string item;
		int i=0;
		foreach (indices(items), item) {
			write(sprintf("%s:%O\n",item,items[item]));
			.wx.Button b=.wx.Button(this_object(), -1, item);
			sizer->Add(b);
/*			if (_typeof(([]))<= _typeof(items[item])) {
				itemActions[i]=MenuFrame(item,items[item]);
			} else
				itemActions[i]=items[item];
			i++; */
		}
	}
}

void main()
{
	implement_app(MenuApp());
}

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