本文整理汇总了C#中Gtk.Widget类的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Widget类的具体用法?C# Gtk.Widget怎么用?C# Gtk.Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gtk.Widget类属于命名空间,在下文中一共展示了Gtk.Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public bool Visit (object ob)
{
if (activeWidget == null && ob is Gtk.Widget)
activeWidget = (Gtk.Widget) ob;
if (ob == ((DefaultWorkbench)IdeApp.Workbench.RootWindow).ActiveWorkbenchWindow)
visitedCurrentDoc = true;
if (ob is MonoDevelop.Components.Docking.AutoHideBox) {
found = true;
return true;
}
if (ob is PropertyPad) {
// Don't change the property grid selection when the focus is inside the property grid itself
found = true;
return true;
}
else if (ob is IPropertyPadProvider) {
DesignerSupport.Service.SetPadContent ((IPropertyPadProvider)ob, activeWidget);
found = true;
return true;
}
else if (ob is ICustomPropertyPadProvider) {
DesignerSupport.Service.SetPadContent ((ICustomPropertyPadProvider)ob, activeWidget);
found = true;
return true;
}
else
return false;
}
示例2: SizingHelper
public SizingHelper(Gtk.Widget window, Gtk.Widget border, bool allow_sizing, uint marginSize)
{
this._window = window;
this._border = border;
this._marginSize = marginSize;
this._allow_sizing = allow_sizing;
// check size request
{
int vw, vh;
this._window.GetSizeRequest(out vw, out vh);
vw = vw <= 0 ? 100 : vw;
vh = vh <= 0 ? 100 : vh;
this._window.SetSizeRequest(100, 100);
}
if (_allow_sizing) {
this._border.AddEvents((int)Gdk.EventMask.PointerMotionMask);
this._border.EnterNotifyEvent += HandleEnterNotifyEvent;
this._border.LeaveNotifyEvent += HandleLeaveNotifyEvent;
this._border.ButtonPressEvent += HandleButtonPressEvent;
this._border.ButtonReleaseEvent += HandleButtonReleaseEvent;
this._border.MotionNotifyEvent += HandleMotionNotifyEvent;
}
// Set style for border from resource style
Gdk.Color bgc = this._window.Style.Background(Gtk.StateType.Selected);
//Gdk.Color.Parse("black", ref bgc);
this._border.ModifyBg(Gtk.StateType.Normal, bgc);
}
示例3: EditorView
public EditorView(ViewContent content)
{
try {
this.content = content;
var editorWidget = content.Control.GetNativeWidget<Gtk.Widget> ();
editorWidget.ShowAll ();
MonoDevelop.Components.Control previewNative;
if (Platform.Instance.IsMac)
{
var editor = new GtkEmbed2(editorWidget);
var editorEto = editor.ToEto();
preview = new PreviewEditorView(editorEto, null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
var nspreview = XamMac2Helpers.ToNative(preview, true);
var nsviewContainer = new NSViewContainer2(nspreview);
previewNative = nsviewContainer;
}
else
{
preview = new PreviewEditorView(editorWidget.ToEto(), null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
previewNative = Gtk2Helpers.ToNative(preview, true);
}
var commandRouterContainer = new CommandRouterContainer (previewNative, content, true);
commandRouterContainer.ShowAll ();
control = commandRouterContainer;
content.DirtyChanged += content_DirtyChanged;
IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged;
ContentName = content.ContentName;
} catch (Exception ex) {
Debug.WriteLine ($"{ex}");
}
}
示例4: ExtensionModelBrowserWidget
public ExtensionModelBrowserWidget ()
{
this.Build ();
NodeBuilder[] builders = new NodeBuilder [] {
new ExtensionNodeBuilder (),
new ExtensionNodeNodeBuilder (),
new ExtensionPointNodeBuilder (),
new AddinNodeBuilder (),
new SolutionNodeBuilder (true),
new RegistryNodeBuilder (),
new AddinCategoryNodeBuilder (),
new MonoDevelop.Ide.Gui.Pads.ProjectPad.WorkspaceNodeBuilder (),
new MonoDevelop.Ide.Gui.Pads.ProjectPad.SolutionFolderNodeBuilder ()
};
TreePadOption[] options = new TreePadOption [] {
new TreePadOption ("ShowExistingNodes", GettextCatalog.GetString ("Show existing nodes"), true)
};
tree = new ExtensibleTreeView (builders, options);
tree.ShowAll ();
paned.Add1 (tree);
foreach (Solution sol in IdeApp.Workspace.GetAllSolutions ())
AddSolution (sol);
docView = new Gtk.Label ();
paned.Add2 (docView);
tree.ShadowType = Gtk.ShadowType.In;
tree.Tree.Selection.Changed += HandleSelectionChanged;
AddinAuthoringService.RegistryChanged += OnRegistryChanged;
IdeApp.Workspace.WorkspaceItemLoaded += OnSolutionLoaded;
IdeApp.Workspace.WorkspaceItemUnloaded += OnSolutionUnloaded;
}
示例5: BaseWidgetAccessible
public BaseWidgetAccessible(Gtk.Widget widget)
{
this.widget = widget;
widget.SizeAllocated += OnAllocated;
widget.Mapped += OnMap;
widget.Unmapped += OnMap;
widget.FocusInEvent += OnFocus;
widget.FocusOutEvent += OnFocus;
widget.AddNotification ("sensitive", (o, a) => NotifyStateChange (StateType.Sensitive, widget.Sensitive));
widget.AddNotification ("visible", (o, a) => NotifyStateChange (StateType.Visible, widget.Visible));
}
示例6: CustomListModel
public CustomListModel(IListDataSource source, Gtk.Widget w)
{
parent = w;
this.source = source;
adapter = new Gtk.TreeModelAdapter (this);
colTypes = source.ColumnTypes;
source.RowChanged += HandleRowChanged;
source.RowDeleted += HandleRowDeleted;
source.RowInserted += HandleRowInserted;
source.RowsReordered += HandleRowsReordered;
}
示例7: PadFontChanger
public PadFontChanger (Gtk.Widget styleSource, Action<FontDescription> updater, Action resizer)
{
this.styleSource = styleSource;
this.updater = updater;
this.resizer = resizer;
if (styleSource != null) {
IdeApp.Preferences.CustomPadFont.Changed += PropertyChanged;
}
Update ();
}
示例8: PListEditorViewContent
public PListEditorViewContent (IPlistEditingHandler handler, Project proj)
{
if (handler != null) {
widget = new PListEditorWidget (handler, proj);
control = (Gtk.Widget) widget;
} else {
widget = new CustomPropertiesWidget ();
var csw = new MonoDevelop.Components.CompactScrolledWindow ();
csw.Show ();
csw.AddWithViewport ((Gtk.Widget)widget);
control = csw;
}
}
示例9: OnComboVisualizersChanged
protected virtual void OnComboVisualizersChanged (object sender, System.EventArgs e)
{
if (currentWidget != null)
mainBox.Remove (currentWidget);
if (comboVisualizers.Active == -1) {
buttonOk.Sensitive = false;
return;
}
buttonOk.Sensitive = true;
currentVisualizer = visualizers [comboVisualizers.Active];
currentWidget = currentVisualizer.GetVisualizerWidget (value);
mainBox.PackStart (currentWidget, true, true, 0);
currentWidget.Show ();
}
示例10: FillMenu
public void FillMenu (ActionTree actionTree)
{
addLabel = null;
if (this.actionTree != null) {
this.actionTree.ChildNodeAdded -= OnChildAdded;
this.actionTree.ChildNodeRemoved -= OnChildRemoved;
}
this.actionTree = actionTree;
if (actionTree == null) {
AddSpacerItem ();
return;
}
actionTree.ChildNodeAdded += OnChildAdded;
actionTree.ChildNodeRemoved += OnChildRemoved;
HideSpacerItem ();
toolItems.Clear ();
Widget wrapper = Stetic.Wrapper.Widget.Lookup (this);
foreach (Gtk.Widget w in Children) {
Remove (w);
w.Destroy ();
}
foreach (ActionTreeNode node in actionTree.Children) {
ActionToolItem aitem = new ActionToolItem (wrapper, this, node);
AddItem (aitem, -1);
toolItems.Add (aitem);
}
if (actionTree.Children.Count == 0) {
// If there are no buttons in the toolbar, give it some height so it is selectable.
AddSpacerItem ();
}
if (showPlaceholder) {
AddCreateItemLabel ();
}
}
示例11: 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));
}
示例12: FillMenu
public void FillMenu (ActionTree actionTree)
{
addLabel = null;
if (this.actionTree != null) {
this.actionTree.ChildNodeAdded -= OnChildAdded;
this.actionTree.ChildNodeRemoved -= OnChildRemoved;
}
this.actionTree = actionTree;
if (actionTree == null) {
AddSpacerItem ();
return;
}
actionTree.ChildNodeAdded += OnChildAdded;
actionTree.ChildNodeRemoved += OnChildRemoved;
HideSpacerItem ();
menuItems.Clear ();
Widget wrapper = Widget.Lookup (this);
foreach (Gtk.Widget w in Children) {
Remove (w);
w.Destroy ();
}
foreach (ActionTreeNode node in actionTree.Children) {
ActionMenuItem aitem = new ActionMenuItem (wrapper, this, node);
AddItem (aitem, -1);
menuItems.Add (aitem);
}
if (showPlaceholder) {
AddCreateItemLabel ();
} else if (actionTree.Children.Count == 0) {
// Give some height to the toolbar
AddSpacerItem ();
}
}
示例13: SetChild
public void SetChild (IWidgetBackend child)
{
RemoveChildPlacement (currentChild);
if (Widget.Child != null) {
if (Widget.Child is Gtk.Bin) {
Gtk.Bin vp = (Gtk.Bin) Widget.Child;
vp.Remove (vp.Child);
}
Widget.Remove (Widget.Child);
}
if (child != null) {
var w = currentChild = GetWidgetWithPlacement (child);
WidgetBackend wb = (WidgetBackend) child;
if (wb.EventSink.SupportsCustomScrolling ()) {
CustomViewPort vp = new CustomViewPort (wb.EventSink);
vp.Show ();
vp.Add (w);
Widget.Child = vp;
}
else if (w is Gtk.Viewport)
Widget.Child = w;
else {
Gtk.Viewport vp = new Gtk.Viewport ();
vp.Show ();
vp.Add (w);
Widget.Child = vp;
}
}
UpdateBorder ();
}
示例14: Drop
public static Gtk.Widget Drop(Gdk.DragContext ctx, Gtk.Widget target, uint time)
{
if (dropCallback != null) {
dragWidget = dropCallback ();
}
if (dragWidget == null) {
Gtk.Drag.GetData (target, ctx, GladeUtils.ApplicationXGladeAtom, time);
return null;
}
Gtk.Widget w = Cancel ();
Gtk.Drag.Finish (ctx, true, true, time);
return w;
}
示例15: Cancel
// Call this from a DragEnd event to check if the widget wasn't dropped
public static Gtk.Widget Cancel()
{
if (dragWidget == null)
return null;
Gtk.Widget w = dragWidget;
dragWidget = null;
// Remove the widget from its dragWindow
Gtk.Container parent = w.Parent as Gtk.Container;
if (parent != null) {
parent.Remove (w);
parent.Destroy ();
}
return w;
}