Exemplo n.º 1
0
        protected override void OnMouseMoved(MouseMovedEventArgs args)
        {
            base.OnMouseMoved(args);
            var hitItem = HitTest(args.Position);

            if (cacheHitItem != hitItem)
            {
                if (cacheHitItem != null)
                {
                    cacheHitItem.OnMouseExited(EventArgs.Empty);
                }
                if (hitItem != null)
                {
                    hitItem.OnMouseEntered(EventArgs.Empty);
                    if (!hitItem.DisplayStyle.HasFlag(ToolItemDisplayStyle.Text))
                    {
                        TooltipText = hitItem.Text;
                        //Debug.WriteLine($"Tooltip Text {TooltipText}");
                    }
                    else
                    {
                        TooltipText = null;
                    }
                }
                cacheHitItem = hitItem;
            }
            else if (cacheHitItem != null)
            {
                cacheHitItem.OnMouseMove(args);
            }
        }
Exemplo n.º 2
0
        public LogExplorer()
        {
            list = new LogList()
            {
                AllowEditColumn  = true,
                EditMode         = EditModes.ByClick,
                GenerateToString = false,
                Grouping         = false,
                Name             = "list",
                ReadOnly         = true,
                ListSource       = Helper.Logs
            };

            toolLoad = new ToolItem(OnToolLoadClick)
            {
                Name = "Load"
            };
            toolSave = new ToolItem(OnToolSaveClick)
            {
                Name = "Save"
            };
            tools = new Toolsbar(toolLoad, toolSave);
            Name  = "LogEditor";

            PackStart(tools, false, false);
            PackStart(list, true, true);

            Localize();
            //System.Drawing.SystemIcons.
        }
Exemplo n.º 3
0
 public override void OnItemClick(ToolItem item)
 {
     base.OnItemClick(item);
     if (!item.Checked)
     {
         CurrentPage = (DockPage)item;
     }
 }
Exemplo n.º 4
0
 public Toolsbar()
 {
     items = new ToolItem()
     {
         Bar = this
     };
     items.StyleName = "Toolsbar";
     Name            = "Bar";
 }
Exemplo n.º 5
0
 protected override void OnMouseExited(EventArgs args)
 {
     base.OnMouseExited(args);
     if (cacheHitItem != null)
     {
         cacheHitItem.OnMouseExited(args);
         cacheHitItem = null;
     }
 }
Exemplo n.º 6
0
 protected override void OnButtonPressed(ButtonEventArgs args)
 {
     base.OnButtonPressed(args);
     hitItem = HitTest(args.Position);
     if (hitItem != null)
     {
         hitItem.OnButtonPressed(args);
     }
 }
Exemplo n.º 7
0
        public void AddButton(string text, EventHandler click)
        {
            var button = new ToolItem(click)
            {
                Name = text,
                Text = text
            };

            bar.Add(button);
        }
Exemplo n.º 8
0
 protected override void OnButtonReleased(ButtonEventArgs args)
 {
     base.OnButtonReleased(args);
     hitItem = HitTest(args.Position);
     if (hitItem != null && args.Button == PointerButton.Left)
     {
         hitItem.OnButtonReleased(args);
     }
     if (args.Button == PointerButton.Right)
     {
         OnContextMenuShow(args);
     }
 }
Exemplo n.º 9
0
        public LocalizeEditor()
        {
            toolLoadImages = new ToolItem(ToolLoadImagesClick)
            {
                DisplayStyle = ToolItemDisplayStyle.Text,
                Name         = "toolLoadImages",
                Text         = "Load Images"
            };

            toolSave = new ToolItem()
            {
                DisplayStyle = ToolItemDisplayStyle.Text,
                Name         = "toolSave",
                Text         = "Save"
            };

            Editor.Bar.Items.Add(new ToolSeparator());
            Editor.Bar.Items.Add(toolSave);
            Editor.Bar.Items.Add(toolLoadImages);
            Editor.ReadOnly = false;
            Editor.List.RetriveCellEditor += (object listItem, object value, ILayoutCell cell) =>
            {
                if (cell.GetEditor(listItem) == null)
                {
                    if (Equals(cell.Name, "ImageKey"))
                    {
                        return(new CellEditorLocalizeImage());
                    }
                    else if (Equals(cell.Name, "Glyph"))
                    {
                        return(new CellEditorGlyph());
                    }
                }
                return(null);
            };

            DataSource = Locale.Instance;

            var images = new ListEditor();

            images.List.ListInfo.ColumnsVisible = false;
            images.List.ListInfo.HeaderVisible  = false;
            images.DataSource = Locale.Instance.Images;

            Name = "LocalizeEditor";
        }
Exemplo n.º 10
0
        public ListExplorer(ListEditor dataEditor)
        {
            Editor = dataEditor;
            Editor.List.HideEmpty         = false;
            Editor.List.EditMode          = EditModes.ByClick;
            Editor.List.ReadOnly          = false;
            Editor.Name                   = "fields";
            Editor.List.SelectionChanged += ListOnSelectionChanged;
            Editor.ItemSelect            += OnEditorItemSelect;
            Editor.GetCellEditor         += OnGetCellEditor;

            toolTree = new ToolFieldEditor()
            {
                FillWidth = true, Editor = new CellEditorList()
            };
            toolTree.Field.BindData(Selection, nameof(ListExplorerCursor.Current));
            toolPrev = new ToolItem(ToolPrevClick)
            {
                Glyph = GlyphType.ArrowLeft
            };
            toolNext = new ToolItem(ToolNextClick)
            {
                Glyph = GlyphType.ArrowRight
            };

            var group = new ToolItem {
                Column = 0, Row = 0
            };

            group.Add(toolPrev);
            group.Add(toolNext);
            group.Add(toolTree);

            Bar.Items.Insert(group, true);

            PackStart(Editor, true, true);
            Name = "OptionEditor";

            Tree                   = ((CellEditorList)toolTree.Editor).DropDown.Target as LayoutList;
            Tree.Mode              = LayoutListMode.Tree;
            Tree.SelectionChanged += OnTreeAfterSelect;
        }
Exemplo n.º 11
0
 public virtual void OnItemDoubleClick(ToolItem item)
 {
 }
Exemplo n.º 12
0
 public virtual void OnItemClick(ToolItem item)
 {
     ItemClick?.Invoke(this, new ToolItemEventArgs {
         Item = item
     });
 }
Exemplo n.º 13
0
        public LayoutInfoEditor()
        {
            CellCopy = new ToolItem(OnMenuCellCopyClick)
            {
                Name = "Copy", Glyph = GlyphType.CopyAlias
            };
            CellCheck = new ToolItem(OnMenuCellCheckClick)
            {
                Name = "Check All", Glyph = GlyphType.CheckSquare
            };
            ViewMode = new ToolItem(OnMenuViewModeClick)
            {
                Name = "Grid View", Glyph = GlyphType.PhotoAlias
            };
            Reset = new ToolItem(OnMenuResetColumnsClick)
            {
                Name = "Reset", Glyph = GlyphType.Refresh
            };
            Print = new ToolItem()
            {
                Glyph = GlyphType.Print
            };
            toolSort = new ToolItem(ToolSortClick)
            {
                Name = "Sort", CheckOnClick = true, Glyph = GlyphType.SortAlphaAsc
            };
            toolGroup = new ToolItem(ToolGroupClick)
            {
                Name = "Group", CheckOnClick = true, Glyph = GlyphType.PlusSquareO
            };

            bar = new Toolsbar(
                ViewMode,
                Reset,
                Print,
                toolGroup,
                toolSort,
                new ToolSeparator(),
                CellCopy,
                CellCheck)
            {
                Name = "PListContext"
            };

            options = new LayoutList()
            {
                EditMode = EditModes.ByClick
            };

            columns = new ListEditor(new LayoutList
            {
                GenerateColumns  = false,
                GenerateToString = false,
                EditMode         = EditModes.ByClick,
                ListInfo         = new LayoutListInfo(
                    new LayoutColumn {
                    Name = nameof(LayoutColumn.ToString), Editable = false, Width = 180
                },
                    new LayoutColumn {
                    Name = nameof(LayoutColumn.Text), FillWidth = true
                },
                    new LayoutColumn {
                    Name = nameof(LayoutColumn.Visible), Width = 50
                },
                    new LayoutColumn {
                    Name = nameof(LayoutColumn.Format)
                })
                {
                    HeaderVisible = false,
                    LevelIndent   = 5,
                    Tree          = true
                }
            });
            columns.List.SelectionChanged += ColumnsItemSelect;
            columns.List.ItemRemoved      += OnColumnRemoved;
            ToolInsert.ItemClick          += ToolInsertItemClick;
            fields = new ListEditor(new LayoutList
            {
                GenerateColumns  = false,
                GenerateToString = false,
                EditMode         = EditModes.ByClick,
                ListInfo         = new LayoutListInfo(
                    new LayoutColumn {
                    Name = nameof(LayoutField.ToString), Editable = false
                },
                    new LayoutColumn {
                    Name = nameof(LayoutField.Text), FillWidth = true
                },
                    new LayoutColumn {
                    Name = nameof(LayoutField.Visible), Width = 50
                },
                    new LayoutColumn {
                    Name = nameof(LayoutField.Format)
                })
            });

            sorts = new ListEditor(new LayoutList
            {
                GenerateColumns  = false,
                GenerateToString = false,
                EditMode         = EditModes.ByClick,
                ListInfo         = new LayoutListInfo(
                    new LayoutColumn {
                    Name = nameof(LayoutSort.Column), FillWidth = true
                },
                    new LayoutColumn {
                    Name = nameof(LayoutSort.Direction)
                },
                    new LayoutColumn {
                    Name = nameof(LayoutSort.IsGroup)
                })
            });

            gColumns = new GroupBoxItem()
            {
                Name       = "columns",
                Widget     = columns,
                Text       = "Columns",
                FillHeight = true,
                FillWidth  = true
            };
            gFields = new GroupBoxItem()
            {
                Name       = "fields",
                Widget     = fields,
                Text       = "Fields",
                Row        = 1,
                FillHeight = true,
                FillWidth  = true
            };
            gSorters = new GroupBoxItem()
            {
                Name       = "sorts",
                Widget     = sorts,
                Text       = "Sort",
                Row        = 2,
                FillHeight = true,
                FillWidth  = true,
                Expand     = false
            };
            var mColumns = new GroupBoxItem(gColumns, gFields, gSorters)
            {
                Column = 1
            };

            gOptions = new GroupBoxItem()
            {
                Name       = "properties",
                Widget     = options,
                Text       = "Properties",
                FillHeight = true,
                Width      = 340
            };

            map = new GroupBox(gOptions, mColumns);

            PackStart(bar, false, false);
            PackStart(map, true, true);
            //BackgroundColor = GuiEnvironment.Theme["Page"].BaseColor;
        }
Exemplo n.º 14
0
        public ToolWindow()// : base(PopupType.Menu)
        {
            var p = 6;

            panel = new ScrollView
            {
                Name = "panel"
            };

            toolLabel = new ToolLabel
            {
                Name      = "toolLabel",
                Text      = "Label",
                FillWidth = true,
            };

            toolClose = new ToolItem(OnCloseClick)
            {
                Name         = "Close",
                Text         = "Close",
                DisplayStyle = ToolItemDisplayStyle.Text
            };

            toolAccept = new ToolItem(OnAcceptClick)
            {
                Name         = "Accept",
                Text         = "Ok",
                DisplayStyle = ToolItemDisplayStyle.Text
            };

            bar = new Toolsbar(
                toolLabel,
                toolClose,
                toolAccept)
            {
                Name = "Bar"
            };
            bar.ButtonPressed  += OnContentMouseDown;
            bar.ButtonReleased += OnContentMouseUp;
            bar.MouseEntered   += OnContentMouseEntered;
            bar.MouseExited    += OnContentMouseExited;
            bar.MouseMoved     += OnContentMouseMove;
            //hbox.Margin = new WidgetSpacing(padding, 0, padding, padding);

            vbox = new VBox
            {
                //Margin = new WidgetSpacing(padding, padding, padding, padding),
                Name = "tools"
            };
            vbox.PackStart(panel, true, true);
            vbox.PackStart(bar, false, false);
            vbox.KeyPressed += OnContentKeyPress;


            BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor.WithIncreasedLight(0.1D);
            Content         = vbox;
            Decorated       = false;
            Name            = "ToolWindow";
            //Resizable = false;
            Resizable       = true;
            Size            = new Size(360, 320);
            ShowInTaskbar   = false;
            InitialLocation = WindowLocation.Manual;
            Padding         = new WidgetSpacing(p, p, p, p);

            timerHide.Interval = 8000;
            timerHide.Elapsed += TimerHideTick;

            timerStart.Interval = 500;
            timerStart.Elapsed += TimerStartTick;
        }
Exemplo n.º 15
0
 public override void OnItemDoubleClick(ToolItem item)
 {
     base.OnItemDoubleClick(item);
     DockBox?.OnPageDoubleClick((DockPage)item);
 }
Exemplo n.º 16
0
        public ListEditor(LayoutList list)
            : base()
        {
            handleGetEditor = ListOnGetCellEditor;

            toolStatusArchive = new ToolMenuItem()
            {
                Name = "Archive", Tag = DBStatus.Archive, Glyph = GlyphType.FlagCheckered
            };
            toolStatusEdit = new ToolMenuItem()
            {
                Name = "Edit", Tag = DBStatus.Edit, GlyphColor = Colors.DarkOrange, Glyph = GlyphType.Flag
            };
            toolStatusError = new ToolMenuItem()
            {
                Name = "Error", Tag = DBStatus.Error, GlyphColor = Colors.DarkRed, Glyph = GlyphType.Flag
            };
            toolStatusDelete = new ToolMenuItem()
            {
                Name = "Delete", Tag = DBStatus.Delete, GlyphColor = Colors.Purple, Sensitive = false, Glyph = GlyphType.Flag
            };
            toolStatusActual = new ToolMenuItem()
            {
                Name = "Actual", Tag = DBStatus.Actual, GlyphColor = Colors.DarkGreen, Sensitive = false, Glyph = GlyphType.Flag
            };
            toolStatusNew = new ToolMenuItem()
            {
                Name = "New", Tag = DBStatus.New, GlyphColor = Colors.DarkBlue, Sensitive = false, Glyph = GlyphType.Flag
            };

            toolStatus = new ToolSplit()
            {
                Name = "Status", Glyph = GlyphType.Flag, DropDown = new Menubar {
                    Name = "Status"
                }
            };
            toolStatus.DropDownItems.AddRange(new[] {
                toolStatusNew,
                toolStatusActual,
                toolStatusEdit,
                toolStatusArchive,
                toolStatusError,
                toolStatusDelete
            });
            toolStatus.ButtonClick += OnToolStatusClick;
            toolStatus.ItemClick   += ToolStatusItemClicked;

            toolPosition = new ToolLabel {
                Name = "Position", Text = "_ / _"
            };

            toolCopy = new ToolMenuItem(OnToolCopyClick)
            {
                Name = "Copy", Glyph = GlyphType.CopyAlias
            };
            toolInsert = new ToolMenuItem(OnToolInsertClick)
            {
                Name = "Insert", Glyph = GlyphType.Plus
            };

            toolCut = new ToolItem(OnToolCutClick)
            {
                Name = "Cut", DisplayStyle = ToolItemDisplayStyle.Text, Visible = false, Glyph = GlyphType.CutAlias
            };
            toolLog = new ToolItem(OnToolLogClick)
            {
                Name = "Logs", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.History
            };
            toolAccess = new ToolItem(ToolAccessClick)
            {
                Name = "Access", DisplayStyle = ToolItemDisplayStyle.Text, CheckOnClick = true, Glyph = Glyph = GlyphType.Key
            };
            toolRefresh = new ToolItem(OnToolRefreshClick)
            {
                Name = "Refresh", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.Refresh
            };
            toolSave = new ToolItem(OnToolSaveClick)
            {
                Name = "Save", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Blue, Glyph = GlyphType.SaveAlias
            };
            toolLoad = new ToolItem(OnToolLoadClick)
            {
                Name = "Load", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.FolderOpen
            };
            toolAdd = new ToolDropDown(toolInsert, toolCopy)
            {
                Name = "Add", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Green, Glyph = GlyphType.PlusCircle
            };
            toolRemove = new ToolItem(OnToolRemoveClick)
            {
                Name = "Remove", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Red, Glyph = GlyphType.MinusCircle
            };
            toolEdit = new ToolItem(OnToolEditClick)
            {
                Name = "Edit", DisplayStyle = ToolItemDisplayStyle.Text, Visible = false, GlyphColor = Colors.SandyBrown, Glyph = GlyphType.Pencil
            };

            bar = new Toolsbar(
                toolRefresh,
                toolLoad,
                toolSave,
                new ToolSeparator(),
                toolAccess,
                toolAdd,
                toolRemove,
                //toolEdit,
                toolCut,
                toolLog,
                toolStatus,
                new ToolSeparator()
            {
                FillWidth = true
            },
                toolPosition)
            {
                Name = "ListEditor"
            };

            box = new VBox()
            {
                Spacing = 1
            };
            box.PackStart(bar, false, false);

            container = new VPaned()
            {
                Name = "container"
            };
            container.Panel1.Content = box;

            PackStart(container, true, true);
            List = list;

            fields                    = (LayoutList)EmitInvoker.CreateObject(list.GetType());
            fields.EditMode           = EditModes.ByClick;
            fields.RetriveCellEditor += handleGetEditor;

            toolWindow = new ToolWindow()
            {
                Target = fields, Mode = ToolShowMode.Dialog
            };
            toolWindow.ButtonAcceptClick += OnToolWindowAcceptClick;
            toolWindow.ButtonCloseClick  += OnToolWindowCancelClick;

            Localize();
        }
Exemplo n.º 17
0
 public void Add(ToolItem item)
 {
     Items.Add(item);
 }