Esempio n. 1
0
 static void ActionStateChanged_cb(IntPtr inst, IntPtr action_name, IntPtr state)
 {
     try {
         GLib.SimpleActionGroup __obj = GLib.Object.GetObject(inst, false) as GLib.SimpleActionGroup;
         __obj.OnActionStateChanged(GLib.Marshaller.Utf8PtrToString(action_name), new GLib.Variant(state));
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Esempio n. 2
0
 static void ActionEnabledChanged_cb(IntPtr inst, IntPtr action_name, bool enabled)
 {
     try {
         GLib.SimpleActionGroup __obj = GLib.Object.GetObject(inst, false) as GLib.SimpleActionGroup;
         __obj.OnActionEnabledChanged(GLib.Marshaller.Utf8PtrToString(action_name), enabled);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Esempio n. 3
0
        public ToolBarDropDownButton(bool showLabel = false)
        {
            Items = new List <ToolBarItem> ();

            menu_button = new Gtk.MenuButton();
            image       = new Image();

            dropdown = new GLib.Menu();
            menu_button.MenuModel  = dropdown;
            menu_button.UsePopover = false;

            action_group = new GLib.SimpleActionGroup();
            menu_button.InsertActionGroup(action_prefix, action_group);

            var box = new HBox();

            if (showLabel)
            {
                box.PackStart(image, true, true, 3);
                label_widget = new Gtk.Label();
                box.PackStart(label_widget, true, false, 2);
            }
            else
            {
                box.PackStart(image, true, true, 5);
            }

            var alignment = new Alignment(0f, 0.5f, 0f, 0f);
            var arrow     = new Arrow(ArrowType.Down, ShadowType.None);

            alignment.Add(arrow);
            box.PackStart(alignment, false, false, 0);

            menu_button.Add(box);
            Add(menu_button);
            ShowAll();
        }
Esempio n. 4
0
        void SetupActions()
        {
            // Format Actions
            var formatActions = new GLib.SimpleActionGroup();

            // Text styling
            var actionBold = new GLib.SimpleAction("bold", null);

            actionBold.Activated += (sender, args) => _editor.ToggleTag("bold");
            formatActions.AddAction(actionBold);

            var actionItalic = new GLib.SimpleAction("italic", null);

            actionItalic.Activated += (sender, args) => _editor.ToggleTag("italic");
            formatActions.AddAction(actionItalic);

            var actionUnderline = new GLib.SimpleAction("underline", null);

            actionUnderline.Activated += (sender, args) => _editor.ToggleTag("underline");
            formatActions.AddAction(actionUnderline);

            // Paragraph justifying
            var actionJustifyLeft = new GLib.SimpleAction("justify-left", null);

            actionJustifyLeft.Activated += (sender, args) => _editor.SetJustify("justify-left");
            formatActions.AddAction(actionJustifyLeft);

            var actionJustifyCenter = new GLib.SimpleAction("justify-center", null);

            actionJustifyCenter.Activated += (sender, args) => _editor.SetJustify("justify-center");
            formatActions.AddAction(actionJustifyCenter);

            var actionJustifyRight = new GLib.SimpleAction("justify-right", null);

            actionJustifyRight.Activated += (sender, args) => _editor.SetJustify("justify-right");
            formatActions.AddAction(actionJustifyRight);

            var actionJustifyFill = new GLib.SimpleAction("justify-fill", null);

            actionJustifyFill.Activated += (sender, args) => _editor.SetJustify("justify-fill");
            formatActions.AddAction(actionJustifyFill);

            // Font size

            // Clear styling
            var actionFormatClear = new GLib.SimpleAction("clear", null);

            actionFormatClear.Activated += (sender, args) => _editor.ClearTags();
            formatActions.AddAction(actionFormatClear);

            var actionFormatToggle = new GLib.SimpleAction("toggle", null);

            actionFormatToggle.Activated += (sender, args) => _editor.ToggleFormatBar();
            formatActions.AddAction(actionFormatToggle);

            InsertActionGroup("format", formatActions);

            // Document Actions
            var documentActions = new GLib.SimpleActionGroup();

            var actionDocumentOpen = new GLib.SimpleAction("create", null);

            actionDocumentOpen.Activated += (sender, args) => CreateDocument();
            documentActions.AddAction(actionDocumentOpen);

            var actionDocumentRemove = new GLib.SimpleAction("remove", null);

            actionDocumentRemove.Activated += (sender, args) => RemoveDocument();
            documentActions.AddAction(actionDocumentRemove);

            InsertActionGroup("document", documentActions);
        }