wxTaskBarIcon

BlitzMax Forums/Brucey's Modules/wxTaskBarIcon

Vertex(Posted 2008) [#1]
Hi!
There is no wxTaskBarIcon.mod ?

I try to wrap it, but my c++ knowlege is not enaugh for it:
- create wxtaskbaricon.mod directory in mod/wx.mod/
- create glue.h and glue.cpp
- create common.bmx and wxtaskbaricon.bmx

glue.h


glue.cpp


common.bmx


wxtaskbaricon.bmx


I don't know how to wrap virtual wxMenu* CreatePopupMenu().

Can you help?

cu olli


Brucey(Posted 2008) [#2]
10 points for effort :-)


Vertex(Posted 2008) [#3]
^^ it works now(code is edited)

SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxTimer
Import wx.wxTaskBarIcon

Global Application : TApplication

Application = New TApplication
Application.Run()

Type TApplication Extends wxApp
	Field Frame       : TFrame

	Method OnInit:Int()
		Frame = New TFrame
		Frame.Create(,, "wxTaskBarIcon Test")
		Frame.Show()
		SetTopWindow(Frame)
		
		Return True
	End Method
End Type

Type TFrame Extends wxFrame
	Field Icon        : wxIcon
	Field TaskbarIcon : wxTaskBarIcon
	Field Timer       : wxTimer

	Method OnInit()
		Icon = New wxIcon.CreateFromFile("icon.ico", wxBITMAP_TYPE_ICO)
		If Not Icon.IsOk() Then Throw("Unable to load `icon.ico`")
		TaskBarIcon = New wxTaskBarIcon.Create()
		Timer = New wxTimer.Create(Self)
		
		ConnectAny(wxEVT_TIMER, OnTick)
		
		Timer.Start(1000)
	End Method
	
	Function OnTick(E:wxEvent)
		Global Show : Int
		
		Local Event : wxTimerEvent, ..
		      _Self : TFrame
		
		Event = wxTimerEvent(E)
		_Self = TFrame(Event.Parent)
		
		Show = Not Show
		If Show Then
			_Self.TaskBarIcon.SetIcon(_Self.Icon, "Hello, world!")
		Else
			_Self.TaskBarIcon.RemoveIcon()
		EndIf
	End Function
End Type


But I don't know how to solve the problem with CreatePopupMenu and if its the right memory management.

cu olli


Brucey(Posted 2008) [#4]
Hi :-)

I've checked in your wxTaskBarIcon, with some minor tweaks, and the CreatePopupMenu functionality (although I haven't tested it yet).

Thanks!