public LoginFrame()
            : base("Account")
        {
            this.BorderWidth     = 10;
            this.loginBox        = new VBox();
            this.loginButtonBox  = new VButtonBox();
            this.loginButton     = new Button();
            this.subscribeButton = new Button();

            // Button Box
            this.Add(loginBox);
            loginBox.PackStart(loginButtonBox, false, false, 10);
            loginBox.Add(loginButtonBox);


            // Login button
            loginButtonBox.PackStart(loginButton, true, true, 0);
            loginButtonBox.Add(loginButton);

            // Login Image button
            this.imageBox     = new HBox();
            this.accountImage = new Image("../../icons/account.png");

            loginButton.Add(imageBox);
            imageBox.PackStart(accountImage, false, false, 3);
            imageBox.Add(accountImage);

            this.loginLabel = new Label(loginText);
            imageBox.PackStart(loginLabel, false, false, 0);
            imageBox.Add(loginLabel);

            // subscribe Button
            loginButtonBox.PackStart(subscribeButton, true, true, 0);
            loginButtonBox.Add(subscribeButton);

            // logout button
            this.logoutLabel  = new Label("Logout");
            this.logoutButton = new Button();
            logoutButton.Add(logoutLabel);

            // subscribe Label Button
            this.subscribeLabel = new Label(subscribeText);
            subscribeButton.Add(subscribeLabel);


            //Buttons
            loginButton.Clicked     += new EventHandler(OpenLoginWindow);
            subscribeButton.Clicked += new EventHandler(OpenSubscribeWindow);

            logoutButton.Clicked += new EventHandler(Logout);

            this.LoginWindow = new Authentication();
            this.LoginWindow.HideAll();

            this.SubscriptionWindow = new Subscription();
            this.SubscriptionWindow.HideAll();
        }
        public OperationFrame()
            : base("Personale Medico")
        {
            this.BorderWidth = 10;

            this.buttonBox             = new VButtonBox();
            this.buttonBox.BorderWidth = 20;

            this.insertPatientLabel  = new Label(inserisciPaziente);
            this.insertDiagLabel     = new Label(inserisciDiagnosiIngr);
            this.distributionLabel   = new Label(somministrazione);
            this.prescriptionLabel   = new Label(prescrizioneFarmaco);
            this.patientArchiveLabel = new Label(archivioPazienti);
            this.dismissPatientLabel = new Label(dimettiPaziente);

            this.insertPatientButton  = new Button();
            this.insertDiagButton     = new Button();
            this.distributionButton   = new Button();
            this.prescriptionButton   = new Button();
            this.patientArchiveButton = new Button();
            this.dismissPatientButton = new Button();

            insertPatientButton.Add(insertPatientLabel);
            insertDiagButton.Add(insertDiagLabel);
            distributionButton.Add(distributionLabel);
            prescriptionButton.Add(prescriptionLabel);
            patientArchiveButton.Add(patientArchiveLabel);
            dismissPatientButton.Add(dismissPatientLabel);

            this.buttonBox.PackStart(insertPatientButton, false, false, 20);
            this.buttonBox.Add(insertPatientButton);
            this.buttonBox.PackStart(insertDiagButton, false, false, 20);
            this.buttonBox.Add(insertDiagLabel);
            this.buttonBox.PackStart(distributionButton, false, false, 20);
            this.buttonBox.Add(distributionButton);
            this.buttonBox.PackStart(prescriptionButton, false, false, 20);
            this.buttonBox.Add(prescriptionButton);
            this.buttonBox.PackStart(patientArchiveButton, false, false, 20);
            this.buttonBox.Add(patientArchiveButton);
            this.buttonBox.PackStart(dismissPatientButton, false, false, 20);
            this.buttonBox.Add(dismissPatientButton);

            insertPatientButton.Clicked += InsertPatientButton_Clicked;

            insertDiagButton.Clicked += InsertDiagButton_Clicked;

            patientArchiveButton.Clicked += PatientArchiveButton_Clicked;

            dismissPatientButton.Clicked += DismissPatient_Clicked;

            this.buttonBox.ShowAll();
        }
예제 #3
0
        public InfoBar(MessageType messageType)
        {
            BorderWidth = 6;
            Spacing     = 6;
            ActionArea  = new VButtonBox()
            {
                Spacing     = 6,
                LayoutStyle = ButtonBoxStyle.Start
            };
            MessageArea = new Alignment(0f, 0f, 1f, 1f);

            this.PackEnd(ActionArea, false, false, 0);
            this.PackEnd(MessageArea, true, true, 0);
            this.MessageType = messageType;
        }
예제 #4
0
        public void ShowTools()
        {
            // Remove any open editor, if present.
            if (current_editor != null)
            {
                active_editor.Hide();
                widgets.Remove(active_editor);
                active_editor = null;
                current_editor.Restore();
                current_editor = null;
            }

            // No need to build the widget twice.
            if (buttons != null)
            {
                buttons.Show();
                return;
            }

            if (widgets == null)
            {
                widgets = new VBox(false, 0)
                {
                    NoShowAll = true
                };
                widgets.Show();
                var widgets_port = new Viewport();
                widgets_port.Add(widgets);
                Add(widgets_port);
                widgets_port.ShowAll();
            }

            // Build the widget (first time we call this method).
            buttons = new VButtonBox {
                BorderWidth = 5,
                Spacing     = 5,
                LayoutStyle = ButtonBoxStyle.Start
            };

            foreach (var editor in editors)
            {
                PackButton(editor);
            }

            buttons.Show();
            widgets.Add(buttons);
        }
        void BuildGui()
        {
            CellRendererText cellId   = new CellRendererText();
            TreeViewColumn   idColumn = new TreeViewColumn();

            idColumn.Title = GettextCatalog.GetString("ID");
            idColumn.PackStart(cellId, false);
            idColumn.AddAttribute(cellId, "text", 0);

            CellRendererText cellTitle   = new CellRendererText();
            TreeViewColumn   titleColumn = new TreeViewColumn();

            titleColumn.Title  = "Title";
            titleColumn.Expand = true;
            titleColumn.Sizing = TreeViewColumnSizing.Fixed;
            titleColumn.PackStart(cellTitle, true);
            titleColumn.AddAttribute(cellTitle, "text", 1);

            CellRendererCombo cellAction   = new CellRendererCombo();
            TreeViewColumn    actionColumn = new TreeViewColumn();

            actionColumn.Title = "Action";
            actionColumn.PackStart(cellAction, false);
            actionColumn.AddAttribute(cellAction, "text", 2);
            cellAction.Editable   = true;
            cellAction.Model      = checkinActions;
            cellAction.TextColumn = 0;
            cellAction.HasEntry   = false;
            cellAction.Edited    += OnActionChanged;
            //checkinActions.AppendValues(WorkItemCheckinAction.None.ToString());
            checkinActions.AppendValues(WorkItemCheckinAction.Associate.ToString());
            //checkinActions.AppendValues(WorkItemCheckinAction.Resolve.ToString());

            workItemsView.AppendColumn(idColumn);
            workItemsView.AppendColumn(titleColumn);
            workItemsView.AppendColumn(actionColumn);

            workItemsView.Model         = workItemStore;
            workItemsView.WidthRequest  = 300;
            workItemsView.HeightRequest = 120;

            this.PackStart(workItemsView, true, true, 3);

            VButtonBox buttonBox = new VButtonBox();
            Button     addButton = new Button();

            addButton.Label        = GettextCatalog.GetString("Add Work Item");
            addButton.Clicked     += OnAddWorkItem;
            removeButton.Label     = GettextCatalog.GetString("Remove Work Item");
            removeButton.Sensitive = false;
            removeButton.Clicked  += OnRemoveWorkItem;

            addButton.WidthRequest = removeButton.WidthRequest = 150;

            buttonBox.PackStart(addButton);
            buttonBox.PackStart(removeButton);
            buttonBox.Layout = ButtonBoxStyle.Start;

            this.PackStart(buttonBox, false, false, 3);

            this.ShowAll();
        }
예제 #6
0
    public MainWindow() : base(WindowType.Toplevel)
    {
        GardenData.LoadedData = GardenData.LoadedData = new GardenData("new project");
        Title = "Garden project '" + GardenData.LoadedData.Name + "'";

        //GardenData.LoadedData = GardenPlanner.MainClass.TestData();


        PlantSideVPaned.Add1(FamilyPlantVarietySelector);


        PlantAreaInfoVPaned.Add1(PlantBox);
        PlantAreaInfoVPaned.Add2(AreaInfo);

        PlantSideVPaned.Add2(PlantAreaInfoVPaned);

        TopPanedToolboxVPaned.Add1(GraphicsSidebarHPaned);
        TopPanedToolboxVPaned.Add2(ToolBox);

        Frame frame;

        PlantBox.Add(PlantAddButton);
        PlantBox.Add(PlantInfoButton);
        PlantBox.Add(PlantEditButton);

        ToolBox.Add(AreaNewButton);
        ToolBox.Add(AreaCancelButton);
        ToolBox.Add(AreaTypeComboBox);
        ToolBox.Add(AreaEditButton);
        ToolBox.Add(AreaDeleteButton);

        frame = new Frame("Zoom");
        frame.Add(ZoomButton);
        ToolBox.Add(frame);

        frame = new Frame("Date");
        VButtonBox buttonBox = new VButtonBox();

        //yearButton = new SpinButton(GardenData.GetFirstYear(), GardenData.GetLastYear(), 1);
        yearButton = new SpinButton(settings.MinYear, settings.MaxYear, 1);
        buttonBox.Add(yearButton);
        buttonBox.Add(monthButton);

        frame.Add(buttonBox);
        ToolBox.Add(frame);

        foreach (Widget w in TopVBox.Children)
        {
            TopVBox.Remove(w);
        }
        TopVBox.Add(MenuBar);
        TopVBox.Add(TopPanedToolboxVPaned);

        if (this.Child == null)
        {
            this.Add(TopVBox);
        }


        ResetForNewData();

        FamilyPlantVarietySelector.SetSizeRequest(100, 400);

        AreaInfo.WrapMode = WrapMode.Word;
        AreaInfo.Editable = false;


        PlantAddButton.Sensitive = false;
        PlantAddButton.Clicked  += (sender, e) =>
        {
            GardenDrawingArea area = GardenDrawingArea.ActiveInstance;
            if (area.SelectedArea is Planting planting && SelectedEntry is PlantVariety variety)
            {
                EditPlantingInfoWindow.ShowPlantingInfoWindow((PlantingInfo plantingInfo) =>
                {
                    planting.AddVariety(variety, plantingInfo);
                    GardenDrawingArea.ActiveInstance.Draw();
                    ShowAreaSelectionInfo(area.SelectedArea);
                }, planting, variety.Name);
            }
            ;
        };

        PlantInfoButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                InfoPlantFamilyWindow.ShowWindow(family, false);
            }
            else if (SelectedEntry is Plant plant)
            {
                InfoPlantWindow.ShowWindow(plant, false);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                InfoPlantVarietyWindow.ShowWindow(variety, false);
            }
        };


        PlantEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                EditPlantFamilyWindow.ShowWindow(family);
            }
            else if (SelectedEntry is Plant plant)
            {
                EditPlantWindow.ShowWindow(plant);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                EditPlantVarietyWindow.ShowWindow(variety);
            }
        };


        ZoomButton.Value       = GardenDrawingArea.Zoom;
        ZoomButton.Events      = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
        ZoomButton.TooltipText = "Zoom";



        AreaNewButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (AreaCancelButtonClicked)
            {
                AreaCancelButtonClicked    = false;
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    GardenDrawingArea.ActiveInstance.UndoSelection();
                    GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                    GardenDrawingArea.ActiveInstance.Draw();
                }
            }
            else if (!AreaNewButton.Active)//deactivated
            {
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    List <GardenPoint> points = GardenDrawingArea.ActiveInstance.NewPoints;
                    switch (AreaTypeComboBox.Active)
                    {
                    case 0:    //garden
                        if (GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count == 0)
                        {
                            GardenDrawingArea.ActiveInstance.Garden.Shape.AddPoints(points);
                            GardenDrawingArea.ActiveInstance.Garden.Shape.FinishPoints();
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                        }
                        break;

                    case 1:    //planting
                        PlantingCreationDialog.ShowPlantingCreationDialog(new List <GardenPoint>(points), (Planting planting) =>
                        {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddPlanting(GardenData.GenID(planting.Name), planting);
                        });


                        break;

                    case 2:    //method area
                        GardenAreaCreationDialog.ShowGardenAreaCreationDialog(new List <GardenPoint>(points), (GardenArea area) => {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddMethodArea(GardenData.GenID(area.Name), area);
                        });

                        break;
                    }
                }
            }
            else //activated
            {
                if (AreaTypeComboBox.Active == 0) //garden
                {
                    if (GardenDrawingArea.ActiveInstance == null || GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count > 0)
                    {
                        AreaNewButton.Active = false;
                        GardenCreationDialog.ShowGardenCreationDialog(new List <GardenPoint>(), ((Garden garden) =>
                        {
                            GardenData.LoadedData.AddGarden(GardenData.GenID(garden.Name), garden);
                            this.ResetForNewData();
                            GardenBedBook.Page = GardenBedBook.NPages - 1;
                            AreaNewButton.Active = true;
                        }));
                    }
                }

                AreaCancelButton.Sensitive = true;
            }
        };


        AreaCancelButton.Sensitive = false;
        AreaCancelButton.Clicked  += (object sender, System.EventArgs e) =>
        {
            AreaCancelButtonClicked    = true;
            AreaCancelButton.Sensitive = false;
            AreaNewButton.Active       = false;
        };


        AreaTypeComboBox.Active   = 0;
        AreaTypeComboBox.Changed += (object sender, System.EventArgs e) =>
        {
            switch (AreaTypeComboBox.Active)
            {
            case 0:
                AreaNewButton.Label = "New Garden";
                break;

            case 1:
                AreaNewButton.Label = "New Planting";
                break;

            case 2:
                AreaNewButton.Label = "New Method Area";
                break;
            }
        };

        AreaEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null || gardenDrawingArea.SelectedArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea is Planting planting)
            {
                PlantingCreationDialog.ShowPlantingEditDialog(planting);
            }
            else if (gardenDrawingArea.SelectedArea is Garden)
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
            else
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
        };

        AreaDeleteButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null)
            {
                return;
            }

            string name = gardenDrawingArea.SelectedArea != null ? gardenDrawingArea.SelectedArea.Name : gardenDrawingArea.Garden.Name;

            Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.OkCancel, "Do you want to delete '" + name + "'?", new { });

            int response = dialog.Run();
            //System.Console.WriteLine("response " + result);
            if (response == (int)ResponseType.Cancel)
            {
            }
            else if (response == (int)ResponseType.Ok)
            {
                if (gardenDrawingArea.Garden != null && (gardenDrawingArea.SelectedArea == null || gardenDrawingArea.SelectedArea is Garden))
                {
                    var garden = gardenDrawingArea.Garden;

                    GardenData.LoadedData.Gardens.Remove(garden.ID);
                    GardenBedBook.Remove(GardenBedBook.GetNthPage(GardenBedBook.CurrentPage));
                    //System.Console.WriteLine("delete garden");
                    GardenDrawingArea.ActiveInstance = null;
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    if (GardenBedBook.Page >= 0 && GardenBedBook.GetNthPage(GardenBedBook.Page) is GardenDrawingArea drawingArea)
                    {
                        GardenDrawingArea.ActiveInstance = drawingArea;
                        drawingArea.Draw();
                    }
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is Planting planting)
                {
                    gardenDrawingArea.Garden.RemovePlanting(planting);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is GardenArea area)
                {
                    gardenDrawingArea.Garden.RemoveMethodArea(area);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
            }
            dialog.Destroy();
        };



        int yearValue = yearButton.ValueAsInt;

        yearButton.ValueChanged += (sender, e) =>
        {
            if (yearButton.ValueAsInt > yearValue)
            {
                monthButton.Value = 1;
            }
            else
            {
                monthButton.Value = 12;
            }
            yearValue = yearButton.ValueAsInt;
            DateChanged();
        };
        monthButton.Changed += (sender, e) =>
        {
            DateChanged();
        };

        void DateChanged()
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea != null && (!gardenDrawingArea.SelectedArea.CheckDate(GetYear(), GetMonth()) || !gardenDrawingArea.Garden.CheckDate(GetYear(), GetMonth())))
            {
                gardenDrawingArea.UndoSelection();
            }
            gardenDrawingArea.Draw();
            ShowAreaSelectionInfo(gardenDrawingArea.SelectedArea);
        }

        //FamilyPlantVarietySelector.Add1(PopulateFamilies(GardenData.LoadedData));
        //RepopulateGrowables();



        //Build();
        this.DeleteEvent += (object o, DeleteEventArgs args) =>
        {
            TryToClose();
            args.RetVal = true;
        };

        this.Destroyed += (sender, e) =>
        {
            GardenPlannerSettings.Save();
            Application.Quit();
        };
    }
예제 #7
0
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList  collection  = (IList)parentRow.PropertyValue;
            string displayName = parentRow.PropertyDescriptor.DisplayName;

            //populate list with existing items
            itemStore = new ListStore(typeof(object), typeof(int), typeof(string));
            for (int i = 0; i < collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString());
            }

            #region Building Dialogue

            //dialogue and buttons
            Dialog dialog = new Dialog();
            dialog.Title       = displayName + " Editor";
            dialog.Modal       = true;
            dialog.AllowGrow   = true;
            dialog.AllowShrink = true;
            dialog.Modal       = true;
            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox();
            dialog.VBox.PackStart(hBox, true, true, 5);

            //propGrid at end
            grid = new PropertyGrid(parentRow.ParentGrid.EditorManager);
            grid.CurrentObject = null;
            grid.WidthRequest  = 200;
            grid.ShowHelp      = false;
            hBox.PackEnd(grid, true, true, 5);

            //followed by item sorting buttons in ButtonBox
            VButtonBox sortButtonBox = new VButtonBox();
            sortButtonBox.LayoutStyle = ButtonBoxStyle.Start;
            Button upButton = new Button();
            Image  upImage  = new Image(Stock.GoUp, IconSize.Button);
            upImage.Show();
            upButton.Add(upImage);
            upButton.Show();
            sortButtonBox.Add(upButton);
            Button downButton = new Button();
            Image  downImage  = new Image(Stock.GoDown, IconSize.Button);
            downImage.Show();
            downButton.Add(downImage);
            downButton.Show();
            sortButtonBox.Add(downButton);
            hBox.PackEnd(sortButtonBox, false, false, 5);

            //Third column is a VBox
            VBox itemsBox = new VBox();
            hBox.PackStart(itemsBox, false, false, 5);

            //which at bottom has add/remove buttons
            HButtonBox addRemoveButtons = new HButtonBox();
            addRemoveButtons.LayoutStyle = ButtonBoxStyle.End;
            Button addButton = new Button(Stock.Add);
            addRemoveButtons.Add(addButton);
            if (types [0].IsAbstract)
            {
                addButton.Sensitive = false;
            }
            Button removeButton = new Button(Stock.Remove);
            addRemoveButtons.Add(removeButton);
            itemsBox.PackEnd(addRemoveButtons, false, false, 10);

            //and at top has list (TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow();
            listScroll.WidthRequest  = 200;
            listScroll.HeightRequest = 320;
            itemsBox.PackStart(listScroll, true, true, 0);

            itemTree = new TreeView(itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport(itemTree);

            //renderers and attribs for TreeView
            CellRenderer rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Index", rdr, "text", 1));
            rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Object", rdr, "text", 2));

            #endregion

            #region Events

            addButton.Clicked          += new EventHandler(addButton_Clicked);
            removeButton.Clicked       += new EventHandler(removeButton_Clicked);
            itemTree.Selection.Changed += new EventHandler(Selection_Changed);
            upButton.Clicked           += new EventHandler(upButton_Clicked);
            downButton.Clicked         += new EventHandler(downButton_Clicked);


            #endregion

            //show and get response
            dialog.ShowAll();
            ResponseType response = (ResponseType)dialog.Run();
            dialog.Destroy();

            //if 'OK' put items back in collection
            if (response == ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction(parentRow.ParentGrid.CurrentObject);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                    {
                        collection.Add(o[0]);
                    }
                    EndTransaction(parentRow.ParentGrid.CurrentObject, tran, old, collection, true);
                }
                catch {
                    EndTransaction(parentRow.ParentGrid.CurrentObject, tran, old, collection, false);
                    throw;
                }
            }

            //clean up so we start fresh if launched again

            itemTree     = null;
            itemStore    = null;
            grid         = null;
            previousIter = TreeIter.Zero;
        }
예제 #8
0
        private void Initialize()
        {
            Title        = Catalog.GetString("New Smart Playlist");
            VBox.Spacing = 8;

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            ok_button = AddStockButton(Stock.Save, ResponseType.Ok, true);

            var builder_box = new VBox()
            {
                BorderWidth = 5,
                Spacing     = 10
            };

            var name_box = new HBox()
            {
                Spacing = 2
            };

            name_box.PackStart(new Label()
            {
                Text         = Catalog.GetString("Playlist _Name:"),
                UseUnderline = true
            }, false, false, 0);

            name_box.PackStart(name_entry = new Entry(), true, true, 0);
            name_entry.Changed           += HandleNameChanged;
            builder_box.PackStart(name_box, false, false, 0);

            builder_box.PackStart(builder = new BansheeQueryBox(), true, true, 0);
            builder.Show();
            builder.Spacing = 4;

            var expander = new Expander(Catalog.GetString("Predefined Smart Playlists"));
            var hbox     = new HBox()
            {
                Spacing = 8
            };
            var scrolled_window = new ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never,
                VscrollbarPolicy = PolicyType.Automatic,
                ShadowType       = ShadowType.In
            };
            var button_box = new VButtonBox()
            {
                Spacing     = 2,
                LayoutStyle = ButtonBoxStyle.Start
            };

            button_box.PackStart(adv_use_button = new Button(Catalog.GetString("Open in editor")), false, false, 0);
            button_box.PackStart(adv_add_button = new Button(Catalog.GetString("Create and save")), false, false, 0);

            scrolled_window.Add(adv_tree_view = new TreeView()
            {
                HeightRequest  = 150,
                HeadersVisible = false
            });
            hbox.PackStart(scrolled_window, true, true, 0);
            hbox.PackStart(button_box, false, false, 0);

            expander.Add(hbox);

            VBox.PackStart(builder_box, true, true, 0);
            VBox.PackStart(expander, false, false, 0);

            // Model is Name, SmartPlaylistDefinition
            ListStore list_model = new ListStore(typeof(string), typeof(SmartPlaylistDefinition));

            bool have_any_predefined = false;

            foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists)
            {
                list_model.AppendValues(
                    String.Format("<b>{0}</b>\n<small>{1}</small>", def.Name, def.Description), def
                    );
                have_any_predefined = true;
            }

            adv_tree_view.Selection.Mode = SelectionMode.Multiple;
            adv_tree_view.Model          = list_model;
            CellRendererText renderer = new CellRendererText();

            renderer.Ellipsize = Pango.EllipsizeMode.End;
            adv_tree_view.AppendColumn("title", renderer, "markup", 0);
            adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;

            UpdateAdvButtons(0);

            adv_add_button.Clicked += HandleAdvAdd;
            adv_use_button.Clicked += HandleAdvUse;

            if (!have_any_predefined)
            {
                expander.NoShowAll = true;
                expander.Hide();
            }

            Update();

            name_entry.GrabFocus();

            ShowAll();
        }
예제 #9
0
파일: Main.cs 프로젝트: qurat231/legacy
    public StryroDesign(string[] args)
    {
        Application.Init();
        store = new ListStore(typeof(string));

        window = new Window("Styro Design");
        window.SetSizeRequest(800, 600);
        window.DeleteEvent += new DeleteEventHandler(Window_Delete);

        vbox1 = new VBox();
        window.Add(vbox1);
        handlebox1 = new HandleBox();
        //vbox1.Add(handlebox1);
        menubar = new MenuBar();
        handlebox1.Add(menubar);
        hpan = new HPaned();
        vbox1.Add(hpan);

        vbox2 = new VBox();
        hpan.Add(vbox2);
        swin1 = new ScrolledWindow();
        vbox2.Add(swin1);
        vport1 = new Viewport();
        swin1.Add(vport1);
        treeview1 = new TreeView();
        vport1.Add(treeview1);
        vbuttonbox1             = new VButtonBox();
        vbuttonbox1.BorderWidth = 5;
        vbuttonbox1.Spacing     = 5;
        vbox2.Add(vbuttonbox1);
        vbox2.SetChildPacking(vbuttonbox1, false, false, 5, Gtk.PackType.Start);

        entry1 = new Entry();
        vbuttonbox1.Add(entry1);

        buttonAdd       = new Button();
        buttonAdd.Label = "Hinzufgen";
        vbuttonbox1.Add(buttonAdd);
        vbuttonbox1.Layout = ButtonBoxStyle.Start;

        swin = new ScrolledWindow();
        hpan.Add(swin);
        vport2 = new Viewport();
        swin.Add(vport2);
        drawing = new Display(0.3f, 2000, 2000, store);
        vport2.Add(drawing);

        treeview1.HeadersVisible = true;
        buttonAdd.Clicked       += new EventHandler(OnAddClicked);
        TreeViewColumn col  = new TreeViewColumn();
        CellRenderer   cell = new CellRendererText();

        col.Title = "Befehl";
        col.PackStart(cell, true);
        col.AddAttribute(cell, "text", 0);
        treeview1.AppendColumn(col);

        treeview1.Model = store;

        window.ShowAll();
        Application.Run();
    }
예제 #10
0
        private void Build()
        {
            _type              = new ComboBox(_options);
            _type.Changed     += OnProviderChange;
            _userLabel         = new Label("Username");
            _username          = new Entry();
            _username.Changed += OnTextChange;
            _passLabel         = new Label("Password");
            _password          = new Entry()
            {
                Visibility = false
            };
            _password.Changed += OnTextChange;
            _defAnimeCheck     = new CheckButton("Use this account for managing anime")
            {
                Name = "defAnime", Sensitive = false
            };
            _defAnimeCheck.Toggled += OnToggle;
            _defMangaCheck          = new CheckButton("Use this account for managing manga")
            {
                Name = "defManga", Sensitive = false
            };
            _defMangaCheck.Toggled += OnToggle;
            _okButton = new Button("OK");
            _okButton.SetSizeRequest(70, 30);
            _okButton.CanDefault = true;
            _okButton.Clicked   += OnOkButton;
            _okButton.Sensitive  = false;
            _cancelButton        = new Button("Cancel");
            _cancelButton.SetSizeRequest(70, 30);
            _cancelButton.Clicked += delegate { Respond(ResponseType.Cancel); };

            var hb1 = new HBox();

            hb1.PackStart(_userLabel, false, false, 7);
            hb1.Add(_username);
            VBox.Add(hb1);

            var hb2 = new HBox();

            hb2.PackStart(_passLabel, false, true, 7);
            hb2.Add(_password);
            VBox.Add(hb2);

            var bb = new VButtonBox {
                _defAnimeCheck, _defMangaCheck
            };

            VBox.Add(bb);

            var hb3 = new HBox();

            hb3.PackStart(new Label("Type"), false, false, 7);
            hb3.Add(_type);
            VBox.Add(hb3);

            ActionArea.Add(_okButton);
            _okButton.GrabDefault();             // Activates when you hit enter
            ActionArea.Add(_cancelButton);
            ShowAll();
        }