Click here to Skip to main content
15,881,588 members
Articles / Programming Languages / C#

Custom controls with MonoDevelop and GTK#

Rate me:
Please Sign up or sign in to vote.
4.40/5 (9 votes)
18 May 2008GPL35 min read 111.6K   1.7K   32  
Movable controls with customized rendering on Linux with Mono.
// MainWindow.cs
// 
// Copyright (C) 2008 Olivier Lecointre - Cadexis
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
using System;
using Gtk;

public partial class MainWindow: Gtk.Window
{	
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
		
		string name ="MovingBox";
		int index = 0;
		
		this.hpaned1.Position = 500;
		
	 	this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Moving Object 1",10,10);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Moving Object 2",10,55);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Mono",10,100);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Gtk#",10,145);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"MonoDevelop",10,190);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Pango",10,235);
		this.mvpanel1.AddMovingObject(name+(index++).ToString(),"Test",10,280);
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}

	protected virtual void OnMvpanel1KeyPressEvent (object o, Gtk.KeyPressEventArgs args)
	{
	}

	protected virtual void OnMvpanel1KeyReleaseEvent (object o, Gtk.KeyReleaseEventArgs args)
	{
	}

	protected virtual void OnMvpanel1ButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
	{
	}

	protected virtual void OnMvpanel1ButtonReleaseEvent (object o, Gtk.ButtonReleaseEventArgs args)
	{
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions