本文整理汇总了C#中Gtk.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetType方法的具体用法?C# Gtk.GetType怎么用?C# Gtk.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixContainerLeak
// Works around BXC #3801 - Managed Container subclasses are incorrectly resurrected, then leak.
// It does this by registering an alternative callback for gtksharp_container_override_forall, which
// ignores callbacks if the wrapper no longer exists. This means that the objects no longer enter a
// finalized->release->dispose->re-wrap resurrection cycle.
// We use a dynamic method to access internal/private GTK# API in a performant way without having to track
// per-instance delegates.
public static void FixContainerLeak (Gtk.Container c)
{
if (containerLeakFixed) {
return;
}
FixContainerLeak (c.GetType ());
}
示例2: RegisterActions
internal static void RegisterActions(Gtk.Widget source, params Gtk.Action[] actions)
{
if(_actions == null)
_actions = new Dictionary<ResourceManager, List<Gtk.Action>>();
var sourceType = source.GetType();
var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);
var rm = new ResourceManager(baseName, sourceType.Assembly);
_actions.Add(rm, new List<Gtk.Action>(actions));
}
示例3: RegisterWidgets
internal static void RegisterWidgets(Gtk.Widget source, params Gtk.Widget[] widgets)
{
if(_widgets == null)
_widgets = new Dictionary<ResourceManager, List<Gtk.Widget>>();
var sourceType = source.GetType();
var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);
var rm = new ResourceManager(baseName, sourceType.Assembly);
if(source is Gtk.Dialog)
{
if(widgets == null)
widgets = new Gtk.Widget[] { };
var widgetsAsList = widgets.ToList();
widgetsAsList.Add(source);
widgets = widgetsAsList.ToArray();
}
_widgets.Add(rm, new List<Gtk.Widget>(widgets));
}
示例4: UpdateCulture
internal static void UpdateCulture(Gtk.Widget source)
{
if(_widgets == null)
_widgets = new Dictionary<ResourceManager, List<Gtk.Widget>>();
var sourceType = source.GetType();
var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);
foreach(var kvp in _widgets)
{
if(string.Compare(kvp.Key.BaseName.ToUpper(), baseName.ToUpper()) == 0)
{
kvp.Value.ForEach(x => x.Translate(kvp.Key));
break;
}
}
}
示例5: AttachToWidget
public void AttachToWidget(Gtk.Widget widget)
{
if (widget == null)
throw new ArgumentNullException ("widget");
int x, y;
widget.GdkWindow.GetOrigin (out x, out y);
if (widget.GetType() != typeof (Gtk.Window) || ! widget.GetType().IsSubclassOf(typeof (Gtk.Window))) {
x += widget.Allocation.X;
y += widget.Allocation.Y;
}
x += widget.Allocation.Width / 2;
y += widget.Allocation.Height / 2;
SetGeometryHints (widget.Screen, x, y);
}
示例6: SendKeyEvent
void SendKeyEvent(Gtk.Widget target, uint keyval, Gdk.ModifierType state, Gdk.EventType eventType, string subWindow)
{
Gdk.KeymapKey[] keyms = Gdk.Keymap.Default.GetEntriesForKeyval (keyval);
if (keyms.Length == 0)
throw new Exception ("Keyval not found");
Gdk.Window win;
if (subWindow == null)
win = target.GdkWindow;
else
win = (Gdk.Window) GetValue (target, target.GetType (), subWindow);
var nativeEvent = new NativeEventKeyStruct {
type = eventType,
send_event = 1,
window = win.Handle,
state = (uint)state,
keyval = keyval,
group = (byte)keyms [0].Group,
hardware_keycode = (ushort)keyms [0].Keycode,
length = 0,
time = Gtk.Global.CurrentEventTime
};
IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc (nativeEvent);
try {
Gdk.EventHelper.Put (new Gdk.EventKey (ptr));
} finally {
Marshal.FreeHGlobal (ptr);
}
}
示例7: LocalizeWidget
/// <summary>
/// Localizes the widget.
/// </summary>
/// <param name="widget">Widget.</param>
public static void LocalizeWidget(Gtk.Widget widget)
{
if (widget.GetType() == typeof(Gtk.Label))
{
Gtk.Label label = (Gtk.Label)widget;
label.Text = Localize(label.Text);
}
if (widget.GetType() == typeof(Gtk.CheckButton))
{
Gtk.CheckButton checkButton = (Gtk.CheckButton)widget;
checkButton.Label = Localize(checkButton.Label);
}
LocalizeWChildrens(widget);
}
示例8: LocalizeWChildrens
/// <summary>
/// Localizes the W childrens.
/// </summary>
/// <param name="widget">Widget.</param>
public static void LocalizeWChildrens(Gtk.Widget widget)
{
if (widget.GetType() == typeof(Gtk.VBox))
{
foreach (Gtk.Widget ch in ((Gtk.VBox)widget).Children)
{
LocalizeWidget(ch);
}
}
if (widget.GetType() == typeof(Gtk.HBox))
{
foreach (Gtk.Widget ch in ((Gtk.HBox)widget).Children)
{
LocalizeWidget(ch);
}
}
if (widget.GetType() == typeof(Gtk.Table))
{
foreach (Gtk.Widget ch in ((Gtk.Table)widget).Children)
{
LocalizeWidget(ch);
}
}
}
示例9: AttachToWidget
public void AttachToWidget(Gtk.Widget widget)
{
int x, y;
widget.GdkWindow.GetOrigin (out x, out y);
if (widget.GetType() != typeof (Gtk.Window) || ! widget.GetType().IsSubclassOf(typeof (Gtk.Window))) {
x += widget.Allocation.X;
y += widget.Allocation.Y;
}
x += widget.Allocation.Width / 2;
y += widget.Allocation.Height / 2;
SetGeometryHints (widget.Screen, x, y);
attach_widget = widget;
status_icon = null;
}
示例10: FormatLocalizedWithPrefix
// special case: no fmt string arguments
public static string FormatLocalizedWithPrefix(this string key, Gtk.Bin o)
{
return (o.GetType().Namespace+"."+key).FormatLocalized();
}
示例11: SetControlText
/// <summary>
/// Sets the given control's text property.
/// </summary>
/// <param name="control">Control to set</param>
/// <param name="tip">ToolTip control</param>
/// <history>
/// [Curtis_Beard] 07/31/2006 Created
/// [Curtis_Beard] 11/06/2006 CHG: Use Gtk controls
/// </history>
public static void SetControlText(Gtk.Widget control, Gtk.Tooltips tip)
{
if (__RootNode != null)
{
string formName = "";
XmlNode node = __RootNode.SelectSingleNode("screen[@name='" + formName + "']");
XmlNode controlNode;
if (node != null)
{
//node found, find control
controlNode = node.SelectSingleNode("control[@name='" + control.Name + "']");
if (controlNode != null)
{
//found control node
string value = controlNode.Attributes["value"].Value;
//text
if (control.GetType() == typeof(Gtk.Label))
{
((Gtk.Label)control).Text = value;
}
else if (control.GetType() == typeof(Gtk.Button))
{
((Gtk.Button)control).Label = value;
}
else if (control.GetType() == typeof(Gtk.CheckButton))
{
((Gtk.CheckButton)control).Label = value;
}
else if (control.GetType() == typeof(Gtk.Frame))
{
((Gtk.Frame)control).Label = value;
}
//tooltip
if (tip != null && controlNode.Attributes["tooltip"] != null)
tip.SetTip(control, controlNode.Attributes["tooltip"].Value, string.Empty);
}
}
}
}