public QatCommands(RibbonQuickAccessToolbar qat)
        {
            if (qat == null)
            {
                throw new ArgumentNullException(nameof(qat));
            }
            IUICollection qatitemsSource = qat.ItemsSource;

            if (qatitemsSource == null)
            {
                throw new ArgumentException("Qat not initialized");
            }
            _collectionChanged = new UICollectionChangedEvent();
            _collectionChanged.ChangedEvent += CollectionChanged_ChangedEvent;
            _collectionChanged.Attach(qatitemsSource);
            uint   count;
            object item;

            qatitemsSource.GetCount(out count);
            for (uint i = 0; i < count; i++)
            {
                qatitemsSource.GetItem(i, out item);
                GalleryCommandPropertySet galleryItem = GetCommandPropertySet(item);
                _controlCommands.Add(galleryItem);
            }
        }
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            DoubleBuffered = true;
            Dock = DockStyle.Top;

            Tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            TabsMargin = new Padding(12, 24 + 2, 20, 0);
            TabTextMargin = new Padding(4, 2, 4, 2);
            TabsPadding = new Padding(8, 5, 8, 3);
            TabContentMargin = new Padding(1, 0, 1, 2);
            PanelPadding = new Padding(3);
            PanelMargin = new Padding(3, 2, 3, 15);
            PanelSpacing = 3;
            ItemPadding = new Padding(1, 0, 1, 0);
            ItemMargin = new Padding(4, 2, 4, 2);
            TabSpacing = 6;
            DropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
            _orbVisible = true;
            OrbDropDown = new RibbonOrbDropDown(this);
            QuickAcessToolbar = new RibbonQuickAccessToolbar(this);
            QuickAccessVisible = true;
        }
        public static void AddButton(RibbonQuickAccessToolbar toolbar, AbstractCommand command)
        {
            if (toolbar.IsNull() ||
                command.IsNull())
            {
                throw new ArgumentNullException();
            }

            toolbar.Items.Add(new RibbonButtonEx(command));

            CommandManager.Instance.Register(command);
        }
Exemple #4
0
        public Form1()
        {
            InitializeComponent();

            _buttonNew                = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonNew);
            _buttonOpen               = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonOpen);
            _buttonSave               = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSave);
            _tabMain                  = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabMain);
            _groupFileActions         = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupFileActions);
            _ribbonQuickAccessToolbar = new RibbonQuickAccessToolbar(_ribbon,
                                                                     (uint)RibbonMarkupCommands.cmdQAT,
                                                                     (uint)RibbonMarkupCommands.cmdCustomizeQAT);

            _buttonNew.ExecuteEvent  += new EventHandler <ExecuteEventArgs>(_buttonNew_ExecuteEvent);
            _buttonSave.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonSave_ExecuteEvent);
            _buttonOpen.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_buttonOpen_ExecuteEvent);

            // register to the QAT customize button
            _ribbonQuickAccessToolbar.ExecuteEvent += new EventHandler <ExecuteEventArgs>(_ribbonQuickAccessToolbar_ExecuteEvent);
        }
Exemple #5
0
        public Form1()
        {
            InitializeComponent();

            _buttonNew = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonNew);
            _buttonOpen = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonOpen);
            _buttonSave = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSave);
            _tabMain = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabMain);
            _groupFileActions = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupFileActions);
            _ribbonQuickAccessToolbar = new RibbonQuickAccessToolbar(_ribbon,
                                                                     (uint)RibbonMarkupCommands.cmdQAT,
                                                                     (uint)RibbonMarkupCommands.cmdCustomizeQAT);

            _buttonNew.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonNew_ExecuteEvent);
            _buttonSave.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonSave_ExecuteEvent);
            _buttonOpen.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonOpen_ExecuteEvent);

            // register to the QAT customize button
            _ribbonQuickAccessToolbar.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_ribbonQuickAccessToolbar_ExecuteEvent);
        }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarsUIAdapter"/> class.
 /// </summary>
 /// <param name="ribbonQuickAccessToolbar"></param>
 public RibbonQuickAccessToolbarUIAdapter(RibbonQuickAccessToolbar ribbonQuickAccessToolbar)
 {
     Guard.ArgumentNotNull(ribbonQuickAccessToolbar, "RibbonQuickAccessToolbar");
     this.ribbonQuickAccessToolbar = ribbonQuickAccessToolbar;
 }
Exemple #7
0
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            //DoubleBuffered = true;
            Dock = DockStyle.Top;

            _tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            _tabsMargin = new Padding(12, 24 + 2, 20, 0);
            _tabTextMargin = new Padding(4, 2, 4, 2);
            _tabsPadding = new Padding(8, 5, 8, 3);
            _tabContentMargin = new Padding(1, 0, 1, 2);
            _panelPadding = new Padding(3);
            _panelMargin = new Padding(3, 2, 3, 15);
            _panelSpacing = 3;
            _itemPadding = new Padding(1, 0, 1, 0);
            _itemMargin = new Padding(4, 2, 4, 2);
            _tabSpacing = 6;
            _dropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
            _orbVisible = true;
            _orbDropDown = new RibbonOrbDropDown(this);
            _quickAcessToolbar = new RibbonQuickAccessToolbar(this);
            _quickAcessVisible = true;
            _MinimizeButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Minimize);
            _MaximizeRestoreButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Maximize);
            _CloseButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Close);

            _MinimizeButton.SetOwner(this);
            _MaximizeRestoreButton.SetOwner(this);
            _CloseButton.SetOwner(this);

            Font = SystemFonts.CaptionFont;

            BorderMode = RibbonWindowMode.NonClientAreaGlass;
            Disposed += new EventHandler(Ribbon_Disposed);

        }
Exemple #8
0
 /// <summary>
 ///     Creates a new collection
 /// </summary>
 /// <param name="ownerGroup"></param>
 internal RibbonQuickAccessToolbarItemCollection(RibbonQuickAccessToolbar toolbar)
 {
     _ownerToolbar = toolbar;
     SetOwner(toolbar.Owner);
 }
 public MyRibbonQuickAccessToolbarViewInfo(RibbonQuickAccessToolbar toolBar) : base(toolBar)
 {
 }