Ejemplo n.º 1
0
        public DateRangeDialog(DateRange query_range, Gtk.Window parent_window)
            : base("DateRangeDialog.ui", "date_range_dialog")
        {
            this.parent_window = parent_window;
            TransientFor = parent_window;
            DefaultResponse = ResponseType.Ok;

            (startframe.Child as Bin).Child = start_dateedit = new DateEdit ();
            start_dateedit.Show ();
            (endframe.Child as Bin).Child = end_dateedit = new DateEdit ();
            end_dateedit.Show ();

            var cell_renderer = new CellRendererText ();

            // Build the combo box with years and month names
            period_combobox.Model = rangestore = new TreeStore (typeof (string));
            period_combobox.PackStart (cell_renderer, true);

            period_combobox.SetCellDataFunc (cell_renderer, new CellLayoutDataFunc (RangeCellFunc));

            foreach (string range in ranges)
                rangestore.AppendValues (GetString(range));

            period_combobox.Changed += HandlePeriodComboboxChanged;
               	 	period_combobox.Active = System.Array.IndexOf(ranges, "last7days"); // Default to Last 7 days

            if (query_range != null) {
                start_dateedit.DateTimeOffset = query_range.Start;
                end_dateedit.DateTimeOffset = query_range.End;
            }
        }
Ejemplo n.º 2
0
 static void Main()
 {
     Gtk.Application.Init ();
     Window w = new Window ("test");
     DateEdit de;
     w.Add (de = new DateEdit ());
     de.DateEditFlags |= DateEditFlags.ShowOffset | DateEditFlags.ShowTime | DateEditFlags.ShowSeconds;
     de.Show ();
     w.Show ();
     Gtk.Application.Run ();
 }