示例#1
0
        public void BindModel(GLib.MenuModel model, string action_namespace)
        {
            IntPtr native_action_namespace = GLib.Marshaller.StringToPtrGStrdup(action_namespace);

            gtk_popover_bind_model(Handle, model == null ? IntPtr.Zero : model.Handle, native_action_namespace);
            GLib.Marshaller.Free(native_action_namespace);
        }
示例#2
0
        public void BindModel(GLib.MenuModel model, string action_namespace, bool with_separators)
        {
            IntPtr native_action_namespace = GLib.Marshaller.StringToPtrGStrdup(action_namespace);

            gtk_menu_shell_bind_model(Handle, model == null ? IntPtr.Zero : model.Handle, native_action_namespace, with_separators);
            GLib.Marshaller.Free(native_action_namespace);
        }
示例#3
0
        public void AppendSection(string label, GLib.MenuModel section)
        {
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);

            g_menu_append_section(Handle, native_label, section == null ? IntPtr.Zero : section.Handle);
            GLib.Marshaller.Free(native_label);
        }
示例#4
0
        public void SetLink(string link, GLib.MenuModel model)
        {
            IntPtr native_link = GLib.Marshaller.StringToPtrGStrdup(link);

            g_menu_item_set_link(Handle, native_link, model == null ? IntPtr.Zero : model.Handle);
            GLib.Marshaller.Free(native_link);
        }
示例#5
0
        public void InsertSubmenu(int position, string label, GLib.MenuModel submenu)
        {
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);

            g_menu_insert_submenu(Handle, position, native_label, submenu == null ? IntPtr.Zero : submenu.Handle);
            GLib.Marshaller.Free(native_label);
        }
示例#6
0
        public void AppendSubmenu(string label, GLib.MenuModel submenu)
        {
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);

            g_menu_append_submenu(Handle, native_label, submenu == null ? IntPtr.Zero : submenu.Handle);
            GLib.Marshaller.Free(native_label);
        }
示例#7
0
 public Popover(Gtk.Widget relative_to, GLib.MenuModel model) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Popover))
     {
         throw new InvalidOperationException("Can't override this constructor.");
     }
     Raw = gtk_popover_new_from_model(relative_to == null ? IntPtr.Zero : relative_to.Handle, model == null ? IntPtr.Zero : model.Handle);
 }
示例#8
0
        public static MenuItem NewSubmenu(string label, GLib.MenuModel submenu)
        {
            IntPtr   native_label = GLib.Marshaller.StringToPtrGStrdup(label);
            MenuItem result       = new MenuItem(g_menu_item_new_submenu(native_label, submenu == null ? IntPtr.Zero : submenu.Handle));

            GLib.Marshaller.Free(native_label);
            return(result);
        }
示例#9
0
        public GLib.MenuModel GetItemLink(int item_index, string link)
        {
            IntPtr native_link = GLib.Marshaller.StringToPtrGStrdup(link);
            IntPtr raw_ret     = g_menu_model_get_item_link(Handle, item_index, native_link);

            GLib.MenuModel ret = GLib.Object.GetObject(raw_ret) as GLib.MenuModel;
            GLib.Marshaller.Free(native_link);
            return(ret);
        }
示例#10
0
        public MenuTracker(Gtk.IActionObservable observer, GLib.MenuModel model, bool with_separators, bool merge_sections, bool mac_os_mode, string action_namespace, Gtk.MenuTrackerInsertFunc insert_func, Gtk.MenuTrackerRemoveFunc remove_func)
        {
            IntPtr native_action_namespace = GLib.Marshaller.StringToPtrGStrdup(action_namespace);

            GtkSharp.MenuTrackerInsertFuncWrapper insert_func_wrapper = new GtkSharp.MenuTrackerInsertFuncWrapper(insert_func);
            GtkSharp.MenuTrackerRemoveFuncWrapper remove_func_wrapper = new GtkSharp.MenuTrackerRemoveFuncWrapper(remove_func);
            Raw = gtk_menu_tracker_new(observer == null ? IntPtr.Zero : ((observer is GLib.Object) ? (observer as GLib.Object).Handle : (observer as Gtk.ActionObservableAdapter).Handle), model == null ? IntPtr.Zero : model.Handle, with_separators, merge_sections, mac_os_mode, native_action_namespace, insert_func_wrapper.NativeDelegate, remove_func_wrapper.NativeDelegate, IntPtr.Zero);
            GLib.Marshaller.Free(native_action_namespace);
        }
        public bool GetNext(string out_link, GLib.MenuModel value)
        {
            IntPtr native_out_link = GLib.Marshaller.StringToPtrGStrdup(out_link);
            bool   raw_ret         = g_menu_link_iter_get_next(Handle, native_out_link, value == null ? IntPtr.Zero : value.Handle);
            bool   ret             = raw_ret;

            GLib.Marshaller.Free(native_out_link);
            return(ret);
        }
示例#12
0
 public MenuItem(GLib.MenuModel model, int item_index) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(MenuItem))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = g_menu_item_new_from_model(model == null ? IntPtr.Zero : model.Handle, item_index);
 }
示例#13
0
 public MenuBar(GLib.MenuModel model) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(MenuBar))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_menu_bar_new_from_model(model == null ? IntPtr.Zero : model.Handle);
 }
示例#14
0
        public MenuSectionBox(Gtk.Stack stack, GLib.MenuModel model, string action_namespace, Gtk.Popover popover) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(MenuSectionBox))
            {
                var vals  = new List <GLib.Value> ();
                var names = new List <string> ();
                CreateNativeObject(names.ToArray(), vals.ToArray());
                return;
            }
            IntPtr native_action_namespace = GLib.Marshaller.StringToPtrGStrdup(action_namespace);

            Raw = gtk_menu_section_box_new_toplevel(stack == null ? IntPtr.Zero : stack.Handle, model == null ? IntPtr.Zero : model.Handle, native_action_namespace, popover == null ? IntPtr.Zero : popover.Handle);
            GLib.Marshaller.Free(native_action_namespace);
        }
示例#15
0
        public MenuItem(string label, GLib.MenuModel section) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(MenuItem))
            {
                var vals  = new List <GLib.Value> ();
                var names = new List <string> ();
                CreateNativeObject(names.ToArray(), vals.ToArray());
                return;
            }
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);

            Raw = g_menu_item_new_section(native_label, section == null ? IntPtr.Zero : section.Handle);
            GLib.Marshaller.Free(native_label);
        }
示例#16
0
        public unsafe uint ExportMenuModel(string object_path, GLib.MenuModel menu)
        {
            IntPtr native_object_path = GLib.Marshaller.StringToPtrGStrdup(object_path);
            IntPtr error   = IntPtr.Zero;
            uint   raw_ret = g_dbus_connection_export_menu_model(Handle, native_object_path, menu == null ? IntPtr.Zero : menu.Handle, out error);
            uint   ret     = raw_ret;

            GLib.Marshaller.Free(native_object_path);
            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
示例#17
0
        private bool InternalGetNext(string out_link, GLib.MenuModel value)
        {
            GetNextNativeDelegate unmanaged = class_abi.BaseOverride <GetNextNativeDelegate>(this.LookupGType(), "get_next");

            if (unmanaged == null)
            {
                return(false);
            }

            IntPtr native_out_link = GLib.Marshaller.StringToPtrGStrdup(out_link);
            bool   __result        = unmanaged(this.Handle, native_out_link, value == null ? IntPtr.Zero : value.Handle);

            GLib.Marshaller.Free(native_out_link);
            return(__result);
        }
示例#18
0
 public Popover(Gtk.Widget relative_to, GLib.MenuModel model) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Popover))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (relative_to != null)
         {
             names.Add("relative_to");
             vals.Add(new GLib.Value(relative_to));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_popover_new_from_model(relative_to == null ? IntPtr.Zero : relative_to.Handle, model == null ? IntPtr.Zero : model.Handle);
 }
        private bool InternalGetNext(string out_link, GLib.MenuModel value)
        {
            GetNextNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("get_next"));
                unmanaged = (GetNextNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetNextNativeDelegate));
            }
            if (unmanaged == null)
            {
                return(false);
            }

            IntPtr native_out_link = GLib.Marshaller.StringToPtrGStrdup(out_link);
            bool   __result        = unmanaged(this.Handle, native_out_link, value == null ? IntPtr.Zero : value.Handle);

            GLib.Marshaller.Free(native_out_link);
            return(__result);
        }
 protected virtual bool OnGetNext(string out_link, GLib.MenuModel value)
 {
     return(InternalGetNext(out_link, value));
 }