9
janvier
2013
Gdl# : le portage c# de Gdl (Gnome Docking library)
janvier
2013
Un article de Rachel
Pas de commentaires
Je vous propose ici la version C# de Gdl à télécharger ici. il y a déjà une dll 32bits mais le projet est inclus si vous voulez
accompagné d’un programme de test :
using System;
using Gtk;
using Gdl;
namespace test
{
class MainClass
{
public static void Main (string[] args)
{
Gtk.Application.Init ();
Gdl.Application.Init ();
MainWindow win = new MainWindow();
win.ShowAll ();
Gtk.Application.Run ();
}
}
public class MainWindow : Window
{
DockMaster master;
DockLayout layout;
Widget CreateTextItem(){
var vbox = new Box(Orientation.Vertical,0);
vbox.Show ();
var scroll = new ScrolledWindow(null,null);
scroll.Show ();
vbox.PackStart (scroll,true,true,0);
scroll.SetPolicy (PolicyType.Automatic,PolicyType.Automatic);
scroll.ShadowType = ShadowType.EtchedIn;
var textview = new TextView();
textview.WrapMode = WrapMode.Word;
textview.Show ();
scroll.Add (textview);
return vbox;
}
Widget CreateStylesItem(Dock dock){
var vbox = new Box(Orientation.Vertical,0);
vbox.Show ();
RadioButton grp = new RadioButton("toto");
vbox.Add (grp);
return vbox;
}
public MainWindow() : base("Docking widget test")
{
this.DeleteEvent += delegate(object sender, DeleteEventArgs e) {
Gtk.Application.Quit ();
};
this.SetDefaultSize (400,400);
var table = new Box(Orientation.Vertical,0);
Add (table);
var dock = new Dock();
master = dock.Master;
layout = new DockLayout(dock);
var dockbar = new DockBar(dock);
dockbar.Style = DockBarStyle.Text;
var box = new Box (Orientation.Horizontal,5);
table.PackStart (box,true,true,0);
box.PackStart (dockbar,false,false,0);
box.PackEnd (dock,true,true,0);
var item1 = new DockItem("item1", "Item #1",DockItemBehavior.Locked);
item1.Add (CreateTextItem ());
dock.Add (item1,DockPlacement.Top);
item1.Show ();
var item2 = new DockItem("item2",
"Item #2: Select the switcher style for notebooks",
Stock.Execute,DockItemBehavior.Normal);
dock.Add (item2,DockPlacement.Right);
item2.Add (CreateStylesItem (dock));
item2.Show ();
new DockPlaceHolder("ph1",dock,DockPlacement.Bottom,false);
new DockPlaceHolder("ph2",dock,DockPlacement.Left,false);
new DockPlaceHolder("ph3",dock,DockPlacement.Right,false);
new DockPlaceHolder("ph4",dock,DockPlacement.Top,false);
}
}
}
using Gtk;
using Gdl;
namespace test
{
class MainClass
{
public static void Main (string[] args)
{
Gtk.Application.Init ();
Gdl.Application.Init ();
MainWindow win = new MainWindow();
win.ShowAll ();
Gtk.Application.Run ();
}
}
public class MainWindow : Window
{
DockMaster master;
DockLayout layout;
Widget CreateTextItem(){
var vbox = new Box(Orientation.Vertical,0);
vbox.Show ();
var scroll = new ScrolledWindow(null,null);
scroll.Show ();
vbox.PackStart (scroll,true,true,0);
scroll.SetPolicy (PolicyType.Automatic,PolicyType.Automatic);
scroll.ShadowType = ShadowType.EtchedIn;
var textview = new TextView();
textview.WrapMode = WrapMode.Word;
textview.Show ();
scroll.Add (textview);
return vbox;
}
Widget CreateStylesItem(Dock dock){
var vbox = new Box(Orientation.Vertical,0);
vbox.Show ();
RadioButton grp = new RadioButton("toto");
vbox.Add (grp);
return vbox;
}
public MainWindow() : base("Docking widget test")
{
this.DeleteEvent += delegate(object sender, DeleteEventArgs e) {
Gtk.Application.Quit ();
};
this.SetDefaultSize (400,400);
var table = new Box(Orientation.Vertical,0);
Add (table);
var dock = new Dock();
master = dock.Master;
layout = new DockLayout(dock);
var dockbar = new DockBar(dock);
dockbar.Style = DockBarStyle.Text;
var box = new Box (Orientation.Horizontal,5);
table.PackStart (box,true,true,0);
box.PackStart (dockbar,false,false,0);
box.PackEnd (dock,true,true,0);
var item1 = new DockItem("item1", "Item #1",DockItemBehavior.Locked);
item1.Add (CreateTextItem ());
dock.Add (item1,DockPlacement.Top);
item1.Show ();
var item2 = new DockItem("item2",
"Item #2: Select the switcher style for notebooks",
Stock.Execute,DockItemBehavior.Normal);
dock.Add (item2,DockPlacement.Right);
item2.Add (CreateStylesItem (dock));
item2.Show ();
new DockPlaceHolder("ph1",dock,DockPlacement.Bottom,false);
new DockPlaceHolder("ph2",dock,DockPlacement.Left,false);
new DockPlaceHolder("ph3",dock,DockPlacement.Right,false);
new DockPlaceHolder("ph4",dock,DockPlacement.Top,false);
}
}
}