public DateEdit(DateTimeOffset dateTimeOffset, DateEditFlags dateEditFlags)
     : base()
 {
     this.dateEditFlags = dateEditFlags;
     this.dateTimeOffset = dateTimeOffset;
     CreateWidget ();
 }
Esempio n. 2
0
 public DateEdit(DateTimeOffset dateTimeOffset, DateEditFlags dateEditFlags) : base()
 {
     this.dateEditFlags  = dateEditFlags;
     this.dateTimeOffset = dateTimeOffset;
     CreateWidget();
 }
		public DateEdit (System.DateTime time, DateEditFlags flags)
		{
			datetime = new DateTimeZone (time);
			datetime.Changed += HandleDateTimeZoneChanged;
			this.flags = flags;

			date_entry = new Gtk.Entry ();
			date_entry.WidthChars = 10;
			date_entry.Changed += HandleDateEntryChanged;
			PackStart (date_entry, true, true, 0);
		
			Gtk.HBox b_box = new Gtk.HBox ();
			b_box.PackStart (new Gtk.Label (Catalog.GetString ("Calendar")), true, true, 0);
			b_box.PackStart (new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), true, false, 0);
			date_button = new Gtk.Button (b_box);
			date_button.Clicked += HandleCalendarButtonClicked;
			PackStart (date_button, false, false, 0);

			calendar = new Gtk.Calendar ();
			calendar.DaySelected += HandleCalendarDaySelected;
			Gtk.Frame frame = new Gtk.Frame ();
			frame.Add (calendar);
			cal_popup = new Gtk.Window (Gtk.WindowType.Popup);
			cal_popup.DestroyWithParent = true;
			cal_popup.Add (frame);
			cal_popup.Shown += HandleCalendarPopupShown;
			cal_popup.GrabNotify += HandlePopupGrabNotify;
			frame.Show ();
			calendar.Show ();

			time_entry = new Gtk.Entry ();
			time_entry.WidthChars = 8;
			time_entry.Changed += HandleTimeEntryChanged;
			PackStart (time_entry, true, true, 0);

			Gtk.CellRendererText timecell = new Gtk.CellRendererText ();
			time_combo = new Gtk.ComboBox ();
			time_store = new Gtk.TreeStore (typeof (string), typeof (int), typeof (int)); 
			time_combo.Model = time_store;
			time_combo.PackStart (timecell, true);
			time_combo.SetCellDataFunc (timecell, new CellLayoutDataFunc (TimeCellFunc));
			time_combo.Realized += FillTimeCombo;
			time_combo.Changed += HandleTimeComboChanged;
			PackStart (time_combo, false, false, 0);

			zone_entry = new Gtk.Entry ();
			zone_entry.IsEditable = false;
			zone_entry.MaxLength = 6;
			zone_entry.WidthChars = 6;
			PackStart (zone_entry, true, true, 0);

			Gtk.CellRendererText offsetcell = new Gtk.CellRendererText ();
			offset_combo = new Gtk.ComboBox ();
			offset_combo.Model = new Gtk.TreeStore (typeof (string), typeof (int));
			offset_combo.PackStart (offsetcell, true);
			offset_combo.SetCellDataFunc (offsetcell, new CellLayoutDataFunc (OffsetCellFunc));
			FillOffsetCombo ();
			offset_combo.Changed += HandleOffsetComboChanged;
			PackStart (offset_combo, false, false, 0);

			Update ();
			ShowAll ();
		}
        public DateEdit(System.DateTime time, DateEditFlags flags)
        {
            datetime          = new DateTimeZone(time);
            datetime.Changed += HandleDateTimeZoneChanged;
            this.flags        = flags;

            date_entry            = new Gtk.Entry();
            date_entry.WidthChars = 10;
            date_entry.Changed   += HandleDateEntryChanged;
            PackStart(date_entry, true, true, 0);

            Gtk.HBox b_box = new Gtk.HBox();
            b_box.PackStart(new Gtk.Label(Catalog.GetString("Calendar")), true, true, 0);
            b_box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), true, false, 0);
            date_button          = new Gtk.Button(b_box);
            date_button.Clicked += HandleCalendarButtonClicked;
            PackStart(date_button, false, false, 0);

            calendar              = new Gtk.Calendar();
            calendar.DaySelected += HandleCalendarDaySelected;
            Gtk.Frame frame = new Gtk.Frame();
            frame.Add(calendar);
            cal_popup = new Gtk.Window(Gtk.WindowType.Popup);
            cal_popup.DestroyWithParent = true;
            cal_popup.Add(frame);
            cal_popup.Shown      += HandleCalendarPopupShown;
            cal_popup.GrabNotify += HandlePopupGrabNotify;
            frame.Show();
            calendar.Show();

            time_entry            = new Gtk.Entry();
            time_entry.WidthChars = 8;
            time_entry.Changed   += HandleTimeEntryChanged;
            PackStart(time_entry, true, true, 0);

            Gtk.CellRendererText timecell = new Gtk.CellRendererText();
            time_combo       = new Gtk.ComboBox();
            time_store       = new Gtk.TreeStore(typeof(string), typeof(int), typeof(int));
            time_combo.Model = time_store;
            time_combo.PackStart(timecell, true);
            time_combo.SetCellDataFunc(timecell, new CellLayoutDataFunc(TimeCellFunc));
            time_combo.Realized += FillTimeCombo;
            time_combo.Changed  += HandleTimeComboChanged;
            PackStart(time_combo, false, false, 0);

            zone_entry            = new Gtk.Entry();
            zone_entry.IsEditable = false;
            zone_entry.MaxLength  = 6;
            zone_entry.WidthChars = 6;
            PackStart(zone_entry, true, true, 0);

            Gtk.CellRendererText offsetcell = new Gtk.CellRendererText();
            offset_combo       = new Gtk.ComboBox();
            offset_combo.Model = new Gtk.TreeStore(typeof(string), typeof(int));
            offset_combo.PackStart(offsetcell, true);
            offset_combo.SetCellDataFunc(offsetcell, new CellLayoutDataFunc(OffsetCellFunc));
            FillOffsetCombo();
            offset_combo.Changed += HandleOffsetComboChanged;
            PackStart(offset_combo, false, false, 0);

            Update();
            ShowAll();
        }