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(); }
public MainWindow() { GuiService.Main = this; Helper.ThreadException += OnThreadException; ListEditor.StatusClick += FieldsEditorStatusClick; ListEditor.LogClick += FieldsEditorLogClick; icon = Application.CreateStatusIcon(); openFD = new OpenFileDialog() { Title = "Open File" }; saveFD = new SaveFileDialog() { Title = "Save File" }; menuProjectCreate = new ToolMenuItem { Name = "Create", DropDown = new Menubar { Name = "Create" } }; menuProjectCreate.ItemClick += ToolProjectCreateItemClick; menuProjectOpen = new ToolMenuItem(ToolProjectOpenClick) { Name = "Open" }; menuProjectProps = new ToolMenuItem(ToolProjectPropertiesClick) { Name = "Properties" }; menuProjectSave = new ToolMenuItem(ToolProjectSaveClick) { Name = "Save" }; menuProjectSaveAs = new ToolMenuItem(ToolProjectSaveAsClick) { Name = "SaveAs" }; menuProjectRecent = new ToolMenuItem() { Name = "Recent" }; menuProjectClose = new ToolMenuItem(ToolProjectCloseClick) { Name = "Close" }; menuProjectExit = new ToolMenuItem(ToolExitOnClick) { Name = "Exit" }; menuProject = new ToolDropDown( menuProjectCreate, menuProjectOpen, menuProjectProps, menuProjectSave, menuProjectSaveAs, menuProjectRecent, menuProjectClose, menuProjectExit) { Name = "Project", DisplayStyle = ToolItemDisplayStyle.Text }; menuView = new ToolDropDown( BuildMenuItem(typeof(PropertiesEditor), "Properties"), BuildMenuItem(typeof(LogExplorer), "Logs"), new ToolSeparator()) { Name = "View", DisplayStyle = ToolItemDisplayStyle.Text }; menuEditUIEnvironment = new ToolMenuItem(ToolEditUIEnvironment) { Name = "UI Environment" }; menuEditLocalize = new ToolMenuItem(ToolEditLocalizeClick) { Name = "Localize" }; menuWindowLang = new ToolMenuItem { Name = "Language", DropDown = new Menubar { Name = "Language" } }; foreach (var info in Locale.Instance.Cultures) { menuWindowLang.DropDown.Items.Add(new ToolLangItem(LangItemClick) { Culture = info, Name = info.Name, Text = info.DisplayName, }); } menuWindowTheme = new ToolMenuItem { Name = "Theme", DropDown = new Menubar { Name = "Theme" } }; foreach (var theme in GuiEnvironment.Instance.Themes) { menuWindowTheme.DropDown.Items.Add(new ToolThemeItem(ThemeItemClick) { Theme = theme, Name = theme.Name, Text = theme.Name, }); } menuWindow = new ToolDropDown( menuEditUIEnvironment, menuEditLocalize, new ToolSeparator(), menuWindowLang, menuWindowTheme) { Name = "Window", DisplayStyle = ToolItemDisplayStyle.Text }; menuHelpAbout = new ToolMenuItem() { Name = "About" }; menuHelp = new ToolDropDown(menuHelpAbout) { Name = "Help", DisplayStyle = ToolItemDisplayStyle.Text }; bar = new Toolsbar( new ToolSeparator { FillWidth = true }, menuView, menuWindow, menuHelp) { Name = "MainBar" }; toolTasks = new ToolSplit { DisplayStyle = ToolItemDisplayStyle.Text, Name = "Tasks" }; toolProgress = new ToolProgressBar { Name = "Progress", Visible = false }; toolLabel = new ToolLabel() { Name = "Label", Text = "_" }; statusBar = new Toolsbar( toolTasks, toolProgress, toolLabel) { Name = "StatusBar" }; dock = new DockBox() { Name = "dock" }; dock.ContentFocus += DockOnContentFocus; //icon.Image = Image.FromResource(GetType(), "datawf.ico"); ; var vbox = new VBox() { Spacing = 0 }; vbox.PackStart(bar, false, false); vbox.PackStart(dock, true, true); vbox.PackStart(statusBar, false, false); Padding = new WidgetSpacing(5, 5, 5, 5); Icon = Image.FromResource(typeof(MainWindow), "datawf.png"); Content = vbox; Name = "Main"; InitialLocation = WindowLocation.CenterScreen; Title = "Main Form"; Size = new Size(1024, 768); BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor; }