コード例 #1
0
ファイル: MainWindow.cs プロジェクト: Brunoivk/NewRestoran
        protected void OnButtonSearchClicked(object sender, EventArgs e)
        {
            if (entrySearch.Text == "")
            {
                nodeviewNarudzbe.NodeStore = narudzbeNodeStore;
            }
            else
            {
                NarudzbeNodeStore nsn = new NarudzbeNodeStore(false);

                foreach (NarudzbeNode n in narudzbeNodeStore)
                {
                    if (n.Broj.Contains(entrySearch.Text))
                    {
                        nsn.AddNode(n);
                    }
                }
                nodeviewNarudzbe.NodeStore = nsn;
                nodeviewNarudzbe.Selection.SelectPath(new TreePath("0"));
                RefreshStatusNodeView();
            }
        }
コード例 #2
0
ファイル: StavkeWindow.cs プロジェクト: Brunoivk/NewRestoran
        public StavkeWindow(NarudzbeNode n, NarudzbeNodeStore ns, bool prikazi) : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            if (prikazi)
            {
                this.Show();
            }

            narudzba                 = n;
            narudzbaStore            = ns;
            nodeviewStavke.NodeStore = n.stavkeNarudzbeNodeStore;

            CellRendererText   statusText   = new CellRendererText();
            CellRendererPixbuf statusPixbuf = new CellRendererPixbuf();

            TreeViewColumn statusColumn = new TreeViewColumn();

            statusColumn.Title    = "Status";
            statusColumn.MinWidth = 50;
            statusColumn.PackStart(statusPixbuf, false);
            statusColumn.PackStart(statusText, true);
            statusColumn.AddAttribute(statusPixbuf, "pixbuf", 5);
            statusColumn.AddAttribute(statusText, "text", 6);

            nodeviewStavke.AppendColumn("Šifra", new CellRendererText(), "text", 0).MinWidth    = 150;
            nodeviewStavke.AppendColumn("Naziv", new CellRendererText(), "text", 1).MinWidth    = 200;
            nodeviewStavke.AppendColumn("Cijena", new CellRendererText(), "text", 2).MinWidth   = 100;
            nodeviewStavke.AppendColumn("Količina", new CellRendererText(), "text", 3).MinWidth = 80;
            nodeviewStavke.AppendColumn("Ukupno", new CellRendererText(), "text", 4).MinWidth   = 100;
            nodeviewStavke.AppendColumn(statusColumn);

            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.NaCekanju.png").ScaleSimple(20, 20, InterpType.Bilinear), "Na čekanju");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.UObradi.png").ScaleSimple(20, 20, InterpType.Bilinear), "U obradi");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Gotovo.png").ScaleSimple(20, 20, InterpType.Bilinear), "Gotovo");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Dostavljeno.png").ScaleSimple(20, 20, InterpType.Bilinear), "Dostavljeno");

            comboboxStatus.Model = dropdownStatusListStore;
            comboboxStatus.PackStart(statusPixbuf, false);
            comboboxStatus.PackStart(statusText, true);
            comboboxStatus.AddAttribute(statusPixbuf, "pixbuf", 0);
            comboboxStatus.AddAttribute(statusText, "text", 1);

            nodeviewStavke.NodeSelection.Changed += NodeSelectionChanged;
            comboboxSifraArtikla.Model            = ArtikliPresenter.ArtikliListStore;

            vboxFormView.Hide();

            this.Resize(500, 500);
            GtkScrolledWindowStavke.HeightRequest = Gdk.Screen.Default.Height / 2;
            scrolledwindowArtikli.HeightRequest   = (Gdk.Screen.Default.Height / 2) - 17;

            labelBrojNarudzbe.LabelProp = narudzba.Broj;
            labelUkupno.LabelProp       = narudzba.Ukupno;
            buttonNajcesce.Click();

            spinbuttonKolicina.Changed  += (sender, e) => spinbuttonKolicina1.Value = spinbuttonKolicina.Value;
            spinbuttonKolicina1.Changed += (sender, e) => spinbuttonKolicina.Value = spinbuttonKolicina1.Value;

            Color c = new Color();

            Color.Parse("#00bd00", ref c);
            labelSpremljeno.ModifyFg(StateType.Normal, c);
            labelSpremljeno.ModifyFont(Pango.FontDescription.FromString("bold 16"));
            labelSpremljeno1.ModifyFg(StateType.Normal, c);
            labelSpremljeno1.ModifyFont(Pango.FontDescription.FromString("bold 16"));

            ForAll <Label>(l => l.ModifyFont(Pango.FontDescription.FromString("bold 10")), new Container[] { hbox2, hbox4, hbox5, hbox6, hbox7, hbox8, hbox9, hbox15 });
            spinbuttonKolicina1.ModifyFont(Pango.FontDescription.FromString("bold 10"));

            nodeviewStavke.Selection.SelectPath(new TreePath("0"));
            nodeviewStavke.GrabFocus();
        }
コード例 #3
0
ファイル: MainWindow.cs プロジェクト: Brunoivk/NewRestoran
        public MainWindow() : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            DB.OpenConnection();

            LoginWindow login = new LoginWindow(this);

            stavkeChanged += () => RefreshStatusNodeView();

            narudzbeNodeStore = new NarudzbeNodeStore(true);
            current           = new StavkaNarudzbeNodeStore();

            fixedrestoransheme.HideToolbox();
            notebookMain.CurrentPage = 0;

            //NodeView za prikaz narudžbi
            nodeviewNarudzbe.AppendColumn("Broj narudžbe", new CellRendererText(), "text", 0).MinWidth = 200;
            nodeviewNarudzbe.AppendColumn("Datum", new CellRendererText(), "text", 1).MinWidth         = 150;
            nodeviewNarudzbe.AppendColumn("Oznaka stola", new CellRendererText(), "text", 2).MinWidth  = 100;
            nodeviewNarudzbe.AppendColumn("Ukupno", new CellRendererText(), "text", 3).MinWidth        = 100;
            nodeviewNarudzbe.NodeStore = narudzbeNodeStore;

            //NodeView za prikaz statusa stavaka narudzbi
            CellRendererText   statusText   = new CellRendererText();
            CellRendererPixbuf statusPixbuf = new CellRendererPixbuf();

            TreeViewColumn statusColumn = new TreeViewColumn();

            statusColumn.Title    = "Status";
            statusColumn.MinWidth = 100;
            statusColumn.PackStart(statusPixbuf, false);
            statusColumn.PackStart(statusText, true);
            statusColumn.AddAttribute(statusPixbuf, "pixbuf", 5);
            statusColumn.AddAttribute(statusText, "text", 6);

            nodeviewNarudzbeStatus.AppendColumn("Šifra artikla", new CellRendererText(), "text", 0).MinWidth = 150;
            nodeviewNarudzbeStatus.AppendColumn("Naziv artikla", new CellRendererText(), "text", 1).MinWidth = 150;
            nodeviewNarudzbeStatus.AppendColumn("Količina", new CellRendererText(), "text", 3).MinWidth      = 70;
            nodeviewNarudzbeStatus.AppendColumn("Oznaka stola", new CellRendererText(), "text", 7).MinWidth  = 100;
            nodeviewNarudzbeStatus.AppendColumn(statusColumn);

            //Odabir prikaza stavaka prema statusu ili sve
            ListStore dropdownStatusListStore = new ListStore(typeof(Pixbuf), typeof(string));

            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.SveAktivne.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve aktivne");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.NaCekanju.png").ScaleSimple(20, 20, InterpType.Bilinear), "Na čekanju");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.UObradi.png").ScaleSimple(20, 20, InterpType.Bilinear), "U obradi");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Gotovo.png").ScaleSimple(20, 20, InterpType.Bilinear), "Gotovo");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Dostavljeno.png").ScaleSimple(20, 20, InterpType.Bilinear), "Dostavljeno");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Sve.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve");

            comboboxStatus.Model = dropdownStatusListStore;
            comboboxStatus.PackStart(statusPixbuf, false);
            comboboxStatus.PackStart(statusText, true);
            comboboxStatus.AddAttribute(statusPixbuf, "pixbuf", 0);
            comboboxStatus.AddAttribute(statusText, "text", 1);
            comboboxStatus.Active = 0;

            //Odabir prikaza statusa stavaka svih ili trenutne narudzbe
            ListStore dropdownSveTrenutnoListStore = new ListStore(typeof(Pixbuf), typeof(string));

            dropdownSveTrenutnoListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Sve.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve");
            dropdownSveTrenutnoListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Selected.png").ScaleSimple(20, 20, InterpType.Bilinear), "Pojedinačno");

            CellRendererText   sveTrenutnoText   = new CellRendererText();
            CellRendererPixbuf sveTrenutnoPixbuf = new CellRendererPixbuf();

            comboboxSveTrenutna.Model = dropdownSveTrenutnoListStore;
            comboboxSveTrenutna.PackStart(sveTrenutnoPixbuf, false);
            comboboxSveTrenutna.PackStart(sveTrenutnoText, true);
            comboboxSveTrenutna.AddAttribute(sveTrenutnoPixbuf, "pixbuf", 0);
            comboboxSveTrenutna.AddAttribute(sveTrenutnoText, "text", 1);
            comboboxSveTrenutna.Active = 0;

            CellRendererText   stolText   = new CellRendererText();
            CellRendererPixbuf stolPixbuf = new CellRendererPixbuf();

            comboboxOznakaStola.PackStart(stolPixbuf, false);
            comboboxOznakaStola.PackStart(stolText, true);
            comboboxOznakaStola.AddAttribute(stolPixbuf, "pixbuf", 0);
            comboboxOznakaStola.AddAttribute(stolText, "text", 1);
            Pixbuf table2chairs = Pixbuf.LoadFromResource("NewRestoran.images.table2chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table4chairs = Pixbuf.LoadFromResource("NewRestoran.images.table4chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table6chairs = Pixbuf.LoadFromResource("NewRestoran.images.table6chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table8chairs = Pixbuf.LoadFromResource("NewRestoran.images.table8chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);

            nodeviewNarudzbe.HeightRequest = nodeviewNarudzbeStatus.HeightRequest = GtkScrolledWindowNarudzbe.HeightRequest =
                GtkScrolledWindowStatusStavaka.HeightRequest = Gdk.Screen.Default.Height / 3;
            fixed5.HeightRequest = nodeviewNarudzbe.HeightRequest + 100;

            //Prikazivanje ili sakrivanje gumbova ovisno o fokusu
            vboxStatusButtons.Hide();
            nodeviewNarudzbeStatus.FocusInEvent  += (o, args) => { vboxStatusButtons.Show(); vboxNarudzbeButtons.Hide(); };
            nodeviewNarudzbeStatus.FocusOutEvent += (o, args) => { vboxStatusButtons.Hide(); vboxNarudzbeButtons.Show(); };
            nodeviewNarudzbe.Selection.Changed   += NodeSelectionChanged;

            this.Resize(fixedrestoransheme.Width + nodeviewNarudzbe.WidthRequest + 170, fixedrestoransheme.Height + 170);
            Color c = new Color();

            Color.Parse("#00bd00", ref c);
            labelSpremljen.ModifyFg(StateType.Normal, c);
            labelSpremljen.ModifyFont(Pango.FontDescription.FromString("bold 16"));

            ForAll <Label>(l => l.ModifyFont(Pango.FontDescription.FromString("bold 10")), new Container[] { hbox8, hbox9, hbox10, hbox11 });
            notebookMain.ShowTabs = false;

            stolChanged += () => {
                ListStore stolOznaka = new ListStore(typeof(Pixbuf), typeof(string));
                StoloviPresenter.stoloviList.ForEach(s => {
                    switch (s.BrojStolica)
                    {
                    case 2: stolOznaka.AppendValues(table2chairs, s.Oznaka); break;

                    case 4: stolOznaka.AppendValues(table4chairs, s.Oznaka); break;

                    case 6: stolOznaka.AppendValues(table6chairs, s.Oznaka); break;

                    case 8: stolOznaka.AppendValues(table8chairs, s.Oznaka); break;

                    default: stolOznaka.AppendValues(null, s.Oznaka); break;
                    }
                });
                comboboxOznakaStola.Model = stolOznaka;
                narudzbeNodeStore.Refresh();
                RefreshStatusNodeView();
            };

            artiklStavkeChanged += () => { narudzbeNodeStore.Refresh(); RefreshStatusNodeView(); };

            stolChanged();

            RefreshStatusNodeView();
            fixedrestoransheme.TableSelected += FixedRestoranShemeTableSelected;
            nodeviewNarudzbe.GrabFocus();
        }