Example #1
0
        public MainWindow()
        {
            Title = string.Format (Catalog.GetString ("{0} Demo Application"), "Hamekoz Xwt");
            InitialLocation = WindowLocation.CenterScreen;
            Icon = Image.FromResource (Resources.Icon);
            WindowState = WindowState.Maximized;
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                var about = new MenuItem {
                    Label = Catalog.GetString ("About"),
                    Image = Icons.Starred.WithSize (IconSize.Small),
                };
                var exit = new MenuItem {
                    Label = Catalog.GetString ("Exit"),
                    Image = Icons.Delete.WithSize (IconSize.Small),
                };
                statusIcon.Menu.Items.Add (about);
                statusIcon.Menu.Items.Add (exit);
                about.Clicked += AboutClicked;
                exit.Clicked += ExitClicked;
                statusIcon.Image = Icon;
            } catch {
                Console.WriteLine (Catalog.GetString ("Status icon could not be shown"));
            }

            panel = new HPaned ();

            store = new TreeStore (nameCol, iconCol, widgetCol);
            menuTree = new TreeView ();
            menuTree.Columns.Add ("", iconCol, nameCol);

            menuTree.DataSource = store;
            menuTree.SelectionChanged += HandleMenuTreeSelectionChanged;
            menuTree.MinWidth = 220;

            panel.Panel1.Content = menuTree;
            panel.Panel1.Content.MarginRight = 5;

            panel.Panel2.Resize = true;

            Content = panel;

            CloseRequested += HandleCloseRequested;

            InitialLocation = WindowLocation.CenterScreen;
        }
Example #2
0
        public MainWindow()
        {
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "CheckBox", typeof(Checkboxes));
            AddSample (null, "Clipboard", typeof(ClipboardSample));
            AddSample (null, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));

            AddSample (null, "Expander", typeof (ExpanderSample));
            AddSample (null, "Progress bars", typeof(ProgressBarSample));
            AddSample (null, "Frames", typeof(Frames));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "Labels", typeof(Labels));
            AddSample (null, "ListBox", typeof(ListBoxSample));
            AddSample (null, "ListView", typeof(ListView1));
            AddSample (null, "Menu", typeof(MenuSamples));
            AddSample (null, "Notebook", typeof(NotebookSample));
            AddSample (null, "Paneds", typeof(PanedViews));
            AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Tables", typeof(Tables));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Tooltips", typeof(Tooltips));
            AddSample (null, "TreeView", typeof(TreeViews));
            AddSample (null, "WidgetEvents", typeof(WidgetEvents));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the Samples.MainWindow class, creating a 2-panel
        /// layout with a TreeStore for Sample selection and a VBox for the sample itself.
        /// </summary>
        public MainWindow()
        {
            // Show a status icon in taskbar if possible
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));

            var n = AddSample (null, "Charts", null);
            AddSample (n, "SimplePlotCanvas", typeof (SimplePlotCanvas));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Example #4
0
        public MainWindow()
        {
            Title = "Xwt Demo Application";
            Width = 500;
            Height = 400;

            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("_File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("_Open"));
            file.SubMenu.Items.Add (new MenuItem ("_New"));
            MenuItem mi = new MenuItem ("_Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("_Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("_Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cu_t"));
            edit.SubMenu.Items.Add (new MenuItem ("_Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "document-generic.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var w = AddSample (null, "Widgets", null);
            AddSample (w, "Boxes", typeof(Boxes));
            AddSample (w, "Buttons", typeof(ButtonSample));
            AddSample (w, "CheckBox", typeof(Checkboxes));
            AddSample (w, "Clipboard", typeof(ClipboardSample));
            AddSample (w, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (w, "ComboBox", typeof(ComboBoxes));
            AddSample (w, "DatePicker", typeof(DatePickerSample));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (w, "Expander", typeof (ExpanderSample));
            AddSample (w, "Progress bars", typeof(ProgressBarSample));
            AddSample (w, "Frames", typeof(Frames));
            AddSample (w, "Images", typeof(Images));
            AddSample (w, "Labels", typeof(Labels));
            AddSample (w, "ListBox", typeof(ListBoxSample));
            AddSample (w, "LinkLabels", typeof(LinkLabels));
            var listView = AddSample (w, "ListView", typeof(ListView1));
            AddSample (listView, "Editable checkboxes", typeof(ListView2));
            AddSample (w, "Markdown", typeof (MarkDownSample));
            AddSample (w, "Menu", typeof(MenuSamples));
            var mn = AddSample (w, "Mnemonics", typeof (Mnemonics));
            AddSample (w, "Notebook", typeof(NotebookSample));
            AddSample (w, "Paneds", typeof(PanedViews));
            AddSample (w, "Popover", typeof(PopoverSample));
            AddSample (w, "RadioButton", typeof (RadioButtonSample));
            AddSample (w, "Scroll View", typeof(ScrollWindowSample));
            AddSample (w, "Scrollbar", typeof(ScrollbarSample));
            AddSample (w, "Slider", typeof (SliderSample));
            AddSample (w, "Spinners", typeof (Spinners));
            AddSample (w, "Tables", typeof (Tables));
            AddSample (w, "Text Entry", typeof (TextEntries));
            AddSample (w, "Password Entry", typeof (PasswordEntries));
            AddSample (w, "TreeView", typeof(TreeViews));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget (Linear)", typeof (CanvasWithWidget_Linear));
            AddSample (n, "Canvas with Widget (Radial)", typeof (CanvasWithWidget_Radial));
            AddSample (n, "Chart", typeof (ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));
            AddSample (n, "Custom Drawn Image", typeof (ImageScaling));
            AddSample (n, "Widget Rendering", typeof (WidgetRendering));

            var wf = AddSample (null, "Widget Features", null);
            AddSample (wf, "Drag & Drop", typeof(DragDrop));
            AddSample (wf, "Widget Events", typeof(WidgetEvents));
            AddSample (wf, "Opacity", typeof(OpacitySample));
            AddSample (wf, "Tooltips", typeof(Tooltips));

            AddSample (null, "Windows", typeof(Windows));

            AddSample (null, "Screens", typeof (ScreensSample));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
Example #5
0
 void SetSize()
 {
     Title = "DHT";
     Width = 800;
     Height = 600;
     this.InitialLocation = WindowLocation.CenterScreen;
     status = Application.CreateStatusIcon ();
 }