GtkSharp/gtk/Label.cs
Mike Kestner 91c58501fa 2001-09-19 Mike Kestner <mkestner@speakeasy.net>
* HACKING : New rulez.
	* NOTES: Killed.  We have a mailing list now for this kind of stuff.
	* glib/makefile : New, to build the new glib-sharp.dll target.
	* glib/Object.cs : (GetObject): Commented out. Design problems here.
	IntPtr's can't be used in the manner this code attempts to use them.
	(Data prop): Commented out.  Apparently keyed properties are not
	supported.
	(Object prop): Renamed RawObject, and made it protected.
	(Events): Fixed to cause list to be initialized if null and then
	return the list.
	* glib/ObjectManager.cs : commented out entirely.  Not sure what this
	code is trying to accomplish and it doesn't compile.
	* glib/Value.cs : New attempt at implementing GValues. Doesn't work
	yet.
	* gtk/Button.cs : Updated to use RawObject.
	(Clicked event): s/EmitDeleteEvent/EmitClickedEvent.
	(Button(String)): s/gtk_label_new_with_lable/gtk_button_new_with_label.
	* gtk/Label.cs : Fixed some yank and paste errors where 2 value params
	were getting passed to all the set_* property methods.
	* gtk/Window.cs : Fixed hanging GTK namespace ref.
	* sample/HelloWorld.cs : Fixed hanging GTK namespace ref.

svn path=/trunk/gtk-sharp/; revision=884
2001-09-19 11:37:15 +00:00

241 lines
5.3 KiB
C#

// GTK.Label.cs - GTK Label class implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (c) 2001 Bob Smith
namespace Gtk {
using System;
using System.Runtime.InteropServices;
public class Label : Widget {
/// <summary>
/// Label Object Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Label Wrapper.
/// </remarks>
public Label (IntPtr o)
{
RawObject = o;
}
/// <summary>
/// Label Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Label with the specified content.
/// </remarks>
[DllImport("gtk-1.3")]
static extern IntPtr gtk_label_new (String str);
public Label (String str)
{
RawObject = gtk_label_new (str);
}
/// <summary>
/// Text Property
/// </summary>
///
/// <remarks>
/// The raw text of the label.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_text (IntPtr hnd, String str);
[DllImport("gtk-1.3")]
static extern String gtk_label_get_text (IntPtr hnd);
public String Text {
get
{
return gtk_label_get_text (RawObject);
}
set
{
gtk_label_set_text (RawObject, value);
}
}
/// <summary>
/// Markup Property
/// </summary>
///
/// <remarks>
/// Text to parse.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_markup (IntPtr hnd, String str);
public String Markup {
set
{
gtk_label_set_markup (RawObject, value);
}
}
/// <summary>
/// Label Property
/// </summary>
///
/// <remarks>
/// Parsed content.
/// </remarks>
/*
[DllImport("gtk-1.3")]
static extern void gtk_label_set_label (IntPtr hnd, String str);
[DllImport("gtk-1.3")]
static extern String gtk_label_get_label (IntPtr hnd);
public String Label {
get
{
return gtk_label_get_label (RawObject);
}
set
{
gtk_label_set_label (RawObject, value);
}
}
*/
/// <summary>
/// Selectable Property
/// </summary>
///
/// <remarks>
/// Is the user able to select text from the label.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_selectable (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_selectable (IntPtr hnd);
public bool Selectable {
get
{
return gtk_label_get_selectable (RawObject);
}
set
{
gtk_label_set_selectable (RawObject, value);
}
}
/// <summary>
/// UseUnderline Property
/// </summary>
///
/// <remarks>
/// Indicates that the next character after an underline should be the accelerator key.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_use_underline (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_use_underline (IntPtr hnd);
public bool UseUnderline {
get
{
return gtk_label_get_use_underline (RawObject);
}
set
{
gtk_label_set_use_underline (RawObject, value);
}
}
/// <summary>
/// UseMarkup Property
/// </summary>
///
/// <remarks>
/// Indicates that the text contains markup.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_use_markup (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_use_markup (IntPtr hnd);
public bool UseMarkup {
get
{
return gtk_label_get_use_markup (RawObject);
}
set
{
gtk_label_set_use_markup (RawObject, value);
}
}
/// <summary>
/// LineWrap Property
/// </summary>
///
/// <remarks>
/// Indicates that the text is automatically wrapped if to long.
/// </remarks>
[DllImport("gtk-1.3")]
static extern void gtk_label_set_line_wrap (IntPtr hnd, bool setting);
[DllImport("gtk-1.3")]
static extern bool gtk_label_get_line_wrap (IntPtr hnd);
public bool LineWrap {
get
{
return gtk_label_get_line_wrap (RawObject);
}
set
{
gtk_label_set_line_wrap (RawObject, value);
}
}
/*
TODO:
void gtk_label_set_attributes(GtkLabel *label, PangoAttrList *attrs);
void gtk_label_set_markup_with_mnemonic(GtkLabel *label, const gchar *str);
void gtk_label_set_pattern(GtkLabel *label, const gchar *pattern);
void gtk_label_set_justify(GtkLabel *label, GtkJustification jtype);
guint gtk_label_parse_uline(GtkLabel *label, const gchar *string);
void gtk_label_get_layout_offsets (GtkLabel *label,
gint *x,
gint *y);
guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
GtkWidget* gtk_label_new_with_mnemonic (const char *str);
void gtk_label_select_region (GtkLabel *label,
gint start_offset,
gint end_offset);
void gtk_label_set_mnemonic_widget (GtkLabel *label,
GtkWidget *widget);
void gtk_label_set_text_with_mnemonic
(GtkLabel *label,
const gchar *str);
PangoAttrList* gtk_label_get_attributes (GtkLabel *label);
GtkJustification gtk_label_get_justify (GtkLabel *label);
PangoLayout* gtk_label_get_layout (GtkLabel *label);
GtkWidget* gtk_label_get_mnemonic_widget (GtkLabel *label);
gboolean gtk_label_get_selection_bounds (GtkLabel *label,
gint *start,
gint *end);
*/
}
}