Wednesday, May 27, 2009

GTK-Sharp: Scrollable (Window) Label Example



using System;

using System.Collections;
using Gtk;

namespace gtkTest
{

public class SWinLabel
{
private Window topWin;

private static int defWidth = 400;
private static double phi = 1.6180339887;
private static int defHeight = (int)( ((double)(defWidth)) / phi);

private ScrolledWindow sWin;

private Label label;
private string labelText;

private string winTitleText;

// ==========================================================

public SWinLabel(string pWinTitleText, string rawLabelText)
{
winTitleText = pWinTitleText;
topWin = new Window(winTitleText);

topWin.SetDefaultSize(defWidth, defHeight);
topWin.SetPosition(WindowPosition.Center); // TODO

sWin = new ScrolledWindow();
sWin.SetPolicy(Gtk.PolicyType.Always, Gtk.PolicyType.Always);
topWin.Add(sWin);
sWin.Show();

labelText = rawLabelText;
label = new Label(rawLabelText);
sWin.AddWithViewport(label);
label.Show();

topWin.Show();
}

// ==========================================================

}
}

No comments:

Post a Comment

comment: