public IPv4Entry()
		{
			CanFocus = true;
			Spacing = 2;
			
			int width, height;
			Icon.SizeLookup(icon_size, out width, out height);
			IconTheme theme = IconTheme.GetForScreen(Screen);

			DrawingCellHBox entrycontents = new DrawingCellHBox();
			entrycontents.PackStart (new DrawingCellNull(), true);
			entrycontents.Spacing = 0;

			labelcontents = new DrawingCellHBox();
			entrycontents.PackEnd (labelcontents, false);
			cells[0] = new IpText (this, DataPart.A);
			cells[1] = new IpText (this, DataPart.Separator);
			cells[2] = new IpText (this, DataPart.B);
			cells[3] = new IpText (this, DataPart.Separator);
			cells[4] = new IpText (this, DataPart.C);
			cells[5] = new IpText (this, DataPart.Separator);
			cells[6] = new IpText (this, DataPart.D);
			foreach (IpText t in cells)
				labelcontents.PackEnd (t, false);

			clearimg = new DrawingCellActivePixbuf (theme.LoadIcon(Stock.Clear, width, 0));
			clearimg.Activated += delegate {
				OnClearData();
			};
			entrycontents.PackStart (clearimg, false);
			
			addimg = new DrawingCellActivePixbuf (theme.LoadIcon(Stock.Add, width, 0));
			addimg.Activated += delegate {
				OnStartCalculator();
			};
			entrycontents.PackStart (addimg, false);

			entry = new DrawingCellEntry (entrycontents);
			entry.SideCut = SideCut.Right;
			PackStart (entry, true);			

			dropdown = new DrawingCellButton (new DrawingCellComboArrow());
			dropdown.SideCut = SideCut.Left;
			dropdown.Activated += delegate {
				OnDropDown();
			};
			PackEnd (dropdown, false);
			
/*			Gtk.Drag.DestSet (this, DestDefaults.All, ValidTargets, Gdk.DragAction.Copy);
			DragDataReceived += HandleDragDataReceived;
			
			Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, ValidTargets, DragAction.Copy);
			DragBegin += HandleDragBegin;
			DragDataGet += HandleDragDataGet;*/
		}
		public TimeEntry()
			: base()
		{
			CanFocus = true;
			Spacing = 2;
			
			int width, height;
			Icon.SizeLookup(icon_size, out width, out height);
			IconTheme theme = IconTheme.GetForScreen(Screen);

			DrawingCellHBox entrycontents = new DrawingCellHBox();
			entrycontents.PackStart (new DrawingCellNull(), true);
			entrycontents.Spacing = 0;

			labelcontents = new DrawingCellHBox();
			entrycontents.PackEnd (labelcontents, false);
			labels[0] = new TimeText (this, DataPart.Hour);
			labels[1] = new TimeText (this, DataPart.HourSeparator);
			labels[2] = new TimeText (this, DataPart.Minute);
			labels[3] = new TimeText (this, DataPart.HourSeparator);
			labels[4] = new TimeText (this, DataPart.Second);
			labels[5] = new TimeText (this, DataPart.MillisecondSeparator);
			labels[6] = new TimeText (this, DataPart.Millisecond);
			labels[7] = new TimeText (this, DataPart.AMPM);
			foreach (TimeText t in labels) {
				t.XPos = 0.5;
				t.YPos = 0.5;
				labelcontents.PackEnd (t, false);
			}
			
			string s = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
			bool res = (s.ToLower().IndexOf("t") > -1);
			if (res == false) {
				s = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern;
				res = (s.ToLower().IndexOf("t") > -1);
			}
			TwelveHour = res;

			clearimg = new DrawingCellActivePixbuf (theme.LoadIcon(Stock.Clear, width, 0));
			clearimg.Activated += delegate {
				OnClearData();
			};
			entrycontents.PackStart (clearimg, false);
			
			addimg = new DrawingCellActivePixbuf (theme.LoadIcon(Stock.Add, width, 0));
			addimg.Activated += delegate {
				OnStartCalculator();
			};
			entrycontents.PackStart (addimg, false);

			entry = new DrawingCellEntry (entrycontents);
//			entry.Padding = 1;
			entry.SideCut = SideCut.Right;
			PackStart (entry, true);
			
			dropdown = new DrawingCellButton (new DrawingCellComboArrow());
			dropdown.SideCut = SideCut.Left;
			dropdown.Activated += delegate {
				OnDropDown();
			};

			PackEnd (dropdown, false);
			
			Gtk.Drag.DestSet (this, DestDefaults.All, ValidTargets, Gdk.DragAction.Copy);
			DragDataReceived += HandleDragDataReceived;
			
			Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, ValidTargets, DragAction.Copy);
			DragBegin += HandleDragBegin;
			DragDataGet += HandleDragDataGet;
		}
		public DateEntry()
			: base()
		{
			CanFocus = true;
			Spacing = 2;
			
			int width, height;
			Icon.SizeLookup(icon_size, out width, out height);
			IconTheme theme = IconTheme.GetForScreen(Screen);

			entrycontents = new DrawingCellHBox();
			entrycontents.PackStart (new DrawingCellNull(), true);
			entrycontents.Spacing = 0;

			string mask = GetShortMask();
			labelcontents = new DrawingCellHBox();
			entrycontents.PackEnd (labelcontents, false);
			labels[0] = new DateText (this, ResolveMode(mask[0]));
			labels[1] = new DateText (this, DataPart.Separator);
			labels[2] = new DateText (this, ResolveMode(mask[1]));
			labels[3] = new DateText (this, DataPart.Separator);
			labels[4] = new DateText (this, ResolveMode(mask[2]));
			foreach (DateText t in labels)
				labelcontents.PackEnd (t, false);



			clearimg = new DrawingCellActivePixbuf (this.RenderIcon(Stock.Clear, IconSize.Menu, ""));
			clearimg.Activated += delegate {
				OnClearData();
			};
			entrycontents.PackStart (clearimg, false);
			
			addimg = new DrawingCellActivePixbuf (this.RenderIcon(Stock.Add, IconSize.Menu, ""));
			addimg.Activated += delegate {
				OnStartCalculator();
			};
			entrycontents.PackStart (addimg, false);

			entry = new DrawingCellEntry (entrycontents);
			entry.SideCut = SideCut.Right;
			PackStart (entry, true);			

			dropdown = new DrawingCellButton (new DrawingCellComboArrow());
			dropdown.SideCut = SideCut.Left;
			dropdown.Activated += delegate {
				OnDropDown();
			};
			PackEnd (dropdown, false);
			
			Gtk.Drag.DestSet (this, DestDefaults.All, ValidTargets, Gdk.DragAction.Copy);
			DragDataReceived += HandleDragDataReceived;
			
			Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, ValidTargets, DragAction.Copy);
			DragBegin += HandleDragBegin;
			DragDataGet += HandleDragDataGet;
		}
Example #4
0
        public DateEntry()
            : base()
        {
            CanFocus = true;
            Spacing  = 2;

            int width, height;

            Icon.SizeLookup(icon_size, out width, out height);
            IconTheme theme = IconTheme.GetForScreen(Screen);

            entrycontents = new DrawingCellHBox();
            entrycontents.PackStart(new DrawingCellNull(), true);
            entrycontents.Spacing = 0;

            string mask = GetShortMask();

            labelcontents = new DrawingCellHBox();
            entrycontents.PackEnd(labelcontents, false);
            labels[0] = new DateText(this, ResolveMode(mask[0]));
            labels[1] = new DateText(this, DataPart.Separator);
            labels[2] = new DateText(this, ResolveMode(mask[1]));
            labels[3] = new DateText(this, DataPart.Separator);
            labels[4] = new DateText(this, ResolveMode(mask[2]));
            foreach (DateText t in labels)
            {
                labelcontents.PackEnd(t, false);
            }



            clearimg            = new DrawingCellActivePixbuf(this.RenderIcon(Stock.Clear, IconSize.Menu, ""));
            clearimg.Activated += delegate {
                OnClearData();
            };
            entrycontents.PackStart(clearimg, false);

            addimg            = new DrawingCellActivePixbuf(this.RenderIcon(Stock.Add, IconSize.Menu, ""));
            addimg.Activated += delegate {
                OnStartCalculator();
            };
            entrycontents.PackStart(addimg, false);

            entry         = new DrawingCellEntry(entrycontents);
            entry.SideCut = SideCut.Right;
            PackStart(entry, true);

            dropdown            = new DrawingCellButton(new DrawingCellComboArrow());
            dropdown.SideCut    = SideCut.Left;
            dropdown.Activated += delegate {
                OnDropDown();
            };
            PackEnd(dropdown, false);

            Gtk.Drag.DestSet(this, DestDefaults.All, ValidTargets, Gdk.DragAction.Copy);
            DragDataReceived += HandleDragDataReceived;

            Gtk.Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, ValidTargets, DragAction.Copy);
            DragBegin   += HandleDragBegin;
            DragDataGet += HandleDragDataGet;
        }