Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new button.
        /// </summary>
        /// <returns>The button.</returns>
        /// <param name="icon">Icon.</param>
        /// <param name="toggleButton">If set to <c>true</c>, then is this a toggle button.</param>
        public ButtonSegment AddButton(Image icon, bool toggleButton = false)
        {
            int childCounter = 0;
            foreach (var child in Children) {
                ButtonSegment s = child as ButtonSegment;
                if (s != null) {
                    if (childCounter == 0) {
                        s.SegmentType = SegmentType.Left;
                    } else {
                        s.SegmentType = SegmentType.Middle;
                    }

                    childCounter++;
                }
            }

            ButtonSegment segment =
                new ButtonSegment(childCounter == 0 ? SegmentType.Left : SegmentType.Right, icon, toggleButton);
            PackStart(segment);

            return segment;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the UI.
        /// </summary>
        void InitializeUI()
        {
            Spacing = 0.0;
            MinWidth = 320;
            PackStart(controlbar, false, false);
            PackEnd(gridView, true);

            controlbar.Spacing = 0;

            controller.MarginRight = 16;

            buttonMask = controller.AddButton(Image.FromResource("Baimp.Resources.icoMask-Normal.png"), true);
            buttonMask.TooltipText = "Show/Hide mask";
            buttonMask.Toggled += ShowMaskToggled;

            buttonMonochrome = controller.AddButton(Image.FromResource("Baimp.Resources.icoMonochrome-Normal.png"), true);
            buttonMonochrome.TooltipText = "Monochrome/Colorized";
            buttonMonochrome.Active = true;
            buttonMonochrome.Toggled += delegate {
                foreach (ScanView s in gridView.Children.OfType<ScanView>()) {
                    s.ShowColorized = !buttonMonochrome.Active;
                }
            };
        }