예제 #1
0
        public MainWindow_Event()
            : base("")
        {
            SetDefaultSize(250, 200);
            SetPosition(WindowPosition.Center);

            DeleteEvent += delegate { Application.Quit(); };

            Fixed fix = new Fixed();

            Button btn = new Button("Enter");
            btn.EnterNotifyEvent += OnEnter;

            _quit = new Button("Quit");
            //_quit.Clicked += OnClick;
            _quit.SetSizeRequest(80, 35);

            CheckButton cb = new CheckButton("connect");
            cb.Toggled += OnToggled;

            fix.Put(btn, 50, 20);
            fix.Put(_quit, 50, 50);
            fix.Put(cb, 120, 20);
            Add(fix);
            ShowAll();
        }
예제 #2
0
        public DebugView(Settings set, DebugManager mgr)
        {
            debugManager = mgr;
            layout = new Table(2, 2, false);
            runStop = new Button("Interrupt");
            command = new Entry();
            log = new ConsoleLog(set);

            command.Activated += OnCommand;
            runStop.Clicked += OnRunStop;

            layout.Attach(log.View, 0, 2, 0, 1,
              AttachOptions.Fill,
              AttachOptions.Expand | AttachOptions.Fill,
              4, 4);
            layout.Attach(command, 0, 1, 1, 2,
              AttachOptions.Fill | AttachOptions.Expand,
              AttachOptions.Fill,
              4, 4);
            layout.Attach(runStop, 1, 2, 1, 2,
              AttachOptions.Fill, AttachOptions.Fill, 4, 4);

            runStop.SetSizeRequest(80, -1);

            command.Sensitive = false;
            runStop.Sensitive = false;

            mgr.MessageReceived += OnDebugOutput;
            mgr.DebuggerBusy += OnBusy;
            mgr.DebuggerReady += OnReady;
            mgr.DebuggerStarted += OnStarted;
            mgr.DebuggerExited += OnExited;
            layout.Destroyed += OnDestroy;
        }
예제 #3
0
        public MainWindow_2()
            : base("Allignment")
        {
            SetDefaultSize(260, 150);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate { Application.Quit(); };

            VBox vbox = new VBox(false, 5);
            HBox hbox = new HBox(true, 3);

            Alignment valign = new Alignment(0, 0.5f, 0, 0);
            vbox.PackStart(valign);

            Button ok = new Button("OK");
            ok.SetSizeRequest(70, 30);
            Button close = new Button("Close");

            hbox.Add(ok);
            hbox.Add(close);

            Alignment halign = new Alignment(0.5f, 0, 0, 0);
            halign.Add(hbox);

            vbox.PackStart(halign, false, false, 3);

            Add(vbox);

            ShowAll();
        }
예제 #4
0
        private void AppendChat(IChat chat)
        {
            Gtk.HBox  container = new Gtk.HBox();
            Gtk.Label label     = new Gtk.Label(chat.Name);
            container.PackStart(label);
            Gtk.Button button = new Gtk.Button(new Gtk.Image(Gtk.IconTheme.Default.LookupIcon("gtk-close", 16, Gtk.IconLookupFlags.NoSvg).LoadIcon()));
            button.Clicked += OnClicked;
            button.Relief   = Gtk.ReliefStyle.None;
            button.SetSizeRequest(20, 20);
            container.PackEnd(button);

            Gtk.TextView   view      = new Logopathy.Gui.ChatView(chat);
            ScrolledWindow view_swin = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));

            view_swin.Add(view);
            view_swin.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);

            hash.Add(container, view);

            int pos = AppendPage(view_swin, container);

            container.ShowAll();

            ShowAll();

            AddedChats.Add(chat);
            ChatToPage.Add(chat, pos);
        }
예제 #5
0
파일: ButtonView.cs 프로젝트: hol353/ApsimX
 /// <summary>Constructor</summary>
 public ButtonView(ViewBase owner)
     : base(owner)
 {
     button = new Button();
     _mainWidget = button;
     button.Clicked += OnButtonClick;
     button.SetSizeRequest(80, 36);
     _mainWidget.Destroyed += _mainWidget_Destroyed;
 }
예제 #6
0
    public Gtk.Widget Render(INode node)
    {
        Gtk.Button button = new Gtk.Button();

        Event ev = (node as EventNode).Event;

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(ev.RawData);

        string fullFunctionName = doc.DocumentElement.SelectSingleNode("/event/name").InnerText.Trim();
        string functionName     = fullFunctionName.Split(new string[] { "::" }, StringSplitOptions.None)[1];

        button.Label = functionName + "()";

        if (ev is IDataTransfer)
        {
            IDataTransfer transfer = ev as IDataTransfer;

            byte[] data = null;

            switch (transfer.Direction)
            {
            case DataTransferDirection.Incoming:
                data = transfer.IncomingData;
                break;

            case DataTransferDirection.Outgoing:
                data = transfer.OutgoingData;
                break;

            case DataTransferDirection.Both:
                data = transfer.IncomingData;
                break;
            }

            try
            {
                string preview = Encoding.UTF8.GetString(data);
                if (preview.Length > 32)
                {
                    button.Label += ": " + preview.Substring(0, 32);
                }
                else
                {
                    button.Label += ": " + preview;
                }
            }
            catch (Exception)
            {
            }
        }

        button.SetSizeRequest((int)node.Allocation.Width, (int)node.Allocation.Height);
        return(button);
    }
예제 #7
0
    public Gtk.Widget Render(INode node)
    {
        Gtk.Button button = new Gtk.Button();

        Event ev = (node as EventNode).Event;

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(ev.RawData);

        string fullFunctionName = doc.DocumentElement.SelectSingleNode("/event/name").InnerText.Trim();
        string functionName = fullFunctionName.Split(new string[] { "::" }, StringSplitOptions.None)[1];

        button.Label = functionName + "()";

        if (ev is IDataTransfer)
        {
            IDataTransfer transfer = ev as IDataTransfer;

            byte[] data = null;

            switch (transfer.Direction)
            {
                case DataTransferDirection.Incoming:
                    data = transfer.IncomingData;
                    break;

                case DataTransferDirection.Outgoing:
                    data = transfer.OutgoingData;
                    break;

                case DataTransferDirection.Both:
                    data = transfer.IncomingData;
                    break;
            }

            try
            {
                string preview = Encoding.UTF8.GetString(data);
                if (preview.Length > 32)
                    button.Label += ": " + preview.Substring(0, 32);
                else
                    button.Label += ": " + preview;
            }
            catch (Exception)
            {
            }
        }

        button.SetSizeRequest((int) node.Allocation.Width, (int) node.Allocation.Height);
        return button;
    }
        private void buildWindow()
        {
            //prevent resize on home screen
            this.Resizable = false;

            EventBox labelContainer = new EventBox ();
            Label confirmLoadLabel = new Label (Constants.Constants.confirmFileReloadText);
            //set the style of the label
            Style labelStyle = confirmLoadLabel.Style.Copy();
            labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            labelStyle.FontDescription.Size = Constants.Constants.CONFIRM_RELOAD_MESSAGE_SIZE;
            confirmLoadLabel.Style = labelStyle.Copy();

            labelContainer.Add (confirmLoadLabel);
            labelContainer.WidthRequest = 100;

            Button yesButton = new Button (Constants.Constants.YES);
            yesButton.Clicked += new EventHandler (LoadFile);

            Button noButton = new Button (Constants.Constants.NO);
            noButton.Clicked += new EventHandler (CancelRequest);

            //set the style of buttons
            Style buttonStyle = yesButton.Style.Copy ();
            buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;

            yesButton.Style = buttonStyle.Copy();
            noButton.Style = buttonStyle.Copy();

            labelContainer.SetSizeRequest (100, 100);
            yesButton.SetSizeRequest (50, 50);
            noButton.SetSizeRequest (50, 50);

            HBox masterContainer = new HBox ();
            VBox mainContainer = new VBox ();

            HBox buttonContainer = new HBox ();

            buttonContainer.PackStart (yesButton, false, false, 50);
            buttonContainer.PackStart (noButton, false, false, 50);

            mainContainer.PackStart (labelContainer, false, false, 50);
            mainContainer.PackStart (buttonContainer, false, false, 50);

            masterContainer.PackStart (mainContainer, true, true, 100);

            this.Add (masterContainer);
        }
예제 #9
0
        /**
         *  Add in all needed components to our welcome window
         * */
        private void buildWindow()
        {
            //prevent resize on home screen
            this.Resizable = false;

            //create label and import button - put label in event box to allow setting of background
            EventBox labelContainer = new EventBox ();

            Label welcomeLabel = new Label (Constants.Constants.homeWindowWelcomeText);

            //set the style of the label
            Style labelStyle = welcomeLabel.Style.Copy();
            labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            labelStyle.FontDescription.Size = Constants.Constants.WELCOME_MESSAGE_FONT_SIZE;
            welcomeLabel.Style = labelStyle.Copy();

            labelContainer.Add (welcomeLabel);
            labelContainer.WidthRequest = 100;

            importDataButton = new Button (Constants.Constants.homeWindowImportButtonText);
            importDataButton.Clicked += new EventHandler(OpenFileTree);

            //set the style of the button
            Style buttonStyle = importDataButton.Style.Copy ();
            buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;
            importDataButton.Style = buttonStyle.Copy();

            welcomeLabel.SetSizeRequest (100, 100);
            importDataButton.SetSizeRequest (100, 100);

            //create container for import button
            HBox masterContainer = new HBox ();
            VBox homeWindowContainer = new VBox (false, 100);

            homeWindowContainer.PackStart (labelContainer, false, false, 50);
            homeWindowContainer.PackStart (importDataButton, false, false, 50);

            masterContainer.PackStart (homeWindowContainer, true, true, 100);

            //set size of containers
            masterContainer.SetSizeRequest (1000, 1000);
            this.SetSizeRequest (1000, 500);
            this.Add (masterContainer);
        }
예제 #10
0
        public TabLabel(Label label, Gtk.Image icon)
            : base(false, 2)
        {
            this.icon = icon;
            this.PackStart (icon, false, true, 2);

            title = label;
            this.PackStart (title, true, true, 0);

            btn = new Button ();
            btn.Add (new Gtk.Image (GetType().Assembly, "MonoDevelop.Close.png"));
            btn.Relief = ReliefStyle.None;
            btn.SetSizeRequest (18, 18);
            this.PackStart (btn, false, false, 2);
            this.ClearFlag (WidgetFlags.CanFocus);

            this.ShowAll ();
        }
예제 #11
0
        protected override void OnSizeAllocated(Gdk.Rectangle alloc)
        {
            base.OnSizeAllocated(alloc);
            int legend_height = LegendHeight();

            Gdk.Rectangle bar = new Rectangle(alloc.X + border, alloc.Y + border,
                                              alloc.Width - 2 * border,
                                              alloc.Height - 2 * border - glass.handle_height);


            if (left.Allocation.Y != bar.Y || left.Allocation.X != bar.X)
            {
                left.SetSizeRequest(-1, bar.Height);
                this.Move(left, bar.X - Allocation.X, bar.Y - Allocation.Y);
            }

            if (right.Allocation.Y != bar.Y || right.Allocation.X != bar.X + bar.Width - right.Allocation.Width)
            {
                right.SetSizeRequest(-1, bar.Height);
                this.Move(right, bar.X - Allocation.X + bar.Width - right.Allocation.Width,
                          bar.Y - Allocation.Y);
            }

            background = new Rectangle(bar.X + left.Allocation.Width, bar.Y,
                                       bar.Width - left.Allocation.Width - right.Allocation.Width,
                                       bar.Height);

            legend = new Rectangle(background.X, background.Y,
                                   background.Width, legend_height);

            action = background.Union(glass.Bounds());

            if (event_window != null)
            {
                event_window.MoveResize(action.X, action.Y, action.Width, action.Height);
            }

            this.Offset = this.Offset;

            UpdateButtons();
        }
		public Screen()
			: base(Gtk.WindowType.Toplevel)
		{
			Build();

			this.SetSizeRequest(500, 100);
			this.DefaultSize = new Gdk.Size(500, 100);

			/* Create a new button */
			buttonLoad = new Button();
			buttonSend = new Button();

			/* Connect the "clicked" signal of the button to our callback */
			buttonLoad.Clicked += new EventHandler(buttonLoad_Clicked);
			buttonLoad.Label = "Load";
			buttonLoad.SetSizeRequest(80, 20);

			buttonSend.Clicked += new EventHandler(buttonSend_Clicked);
			buttonSend.Label = "Send";
			buttonSend.SetSizeRequest(80, 20);

			textBoxLoad = new Entry("image file");
			textBoxLoad.SetSizeRequest(320, 20);
			textBoxSend = new Entry(HolisticWare.SlideShow.BusinessLogic.WebServiceClientProxy.Url);
			textBoxSend.SetSizeRequest(320, 20);

			fix = new Fixed();

			fix.Put(textBoxLoad, 20, 20);
			fix.Put(textBoxSend, 20, 50);
			fix.Put(buttonLoad, 360, 20);
			fix.Put(buttonSend, 360, 50);

			Add(fix);

			this.ShowAll();

			return;
		}
예제 #13
0
	public DocumentTab (Notebook docTabs) : base ()
	{
		doc_tabs = docTabs;
		InitializeProperties ();
		
		editor = new DocumentEditor ();
		this.Add (editor);
		
		tab_label = new HBox (false, 2);
		title_label = new Label ("Untitled");
		
		// Close tab button
		Button tabClose = new Button ();
		Image img = new Image (Stock.Close, IconSize.SmallToolbar);
		tabClose.Add (img);
		tabClose.Relief = ReliefStyle.None;
		tabClose.SetSizeRequest (23, 23);
		tabClose.Clicked += new EventHandler (OnTabClose);
		
		tab_label.PackStart (title_label, true, true, 0);
		tab_label.PackStart (tabClose, false, false, 2);
		
		tab_label.ShowAll ();
	}
예제 #14
0
파일: Main.cs 프로젝트: rajenmistry/arduino
        public MainClass()
            : base("Buttons")
        {
            sPort.PortName = "/dev/ttyACM0";
            sPort.BaudRate = 9600;
            sPort.Open ();

            SetDefaultSize (250, 300);
            SetPosition (WindowPosition.Center);
            DeleteEvent += delegate{
                Application.Quit ();
            };

            Fixed fix = new Fixed ();
            Button green = new Button ("Green");
            green.Name = ("Green");
            green.SetSizeRequest(50,30);

            Button red = new Button ("Red");
            red.Name = ("Red");
            red.SetSizeRequest(50,30);

            Button yellow = new Button ("Yellow");
            yellow.Name = ("Yellow");
            yellow.SetSizeRequest(50,30);

            green.Clicked += new EventHandler (OnClick);
            red.Clicked += new EventHandler (OnClick);
            yellow.Clicked += new EventHandler (OnClick);

            fix.Put(green,20,30);
            fix.Put (red, 80, 30);
            fix.Put (yellow, 140, 30);
            Add (fix);
            ShowAll ();
        }
예제 #15
0
        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.SetPosition(WindowPosition.Mouse);
            window.KeepAbove = true;
            window.Resize(200, 150);
            window.Title = "Dimensions";
            window.Deletable = false;

            Fixed fix = new Fixed();

            // width
            widthLabel = new Label();
            widthLabel.Text = "Width";
            fix.Put(widthLabel, 15, 25);

            widthInputEntry = new Entry();
            widthInputEntry.SetSizeRequest(100, 25);
            widthInputEntry.TextInserted += OnlyNumber;
            widthInputEntry.TextInserted += ChangeWidth;
            widthInputEntry.TextDeleted += ChangeWidth;
            fix.Put(widthInputEntry, 80, 20);

            // height
            heightLabel = new Label();
            heightLabel.Text = "Height";
            fix.Put(heightLabel, 15, 75);

            heightInputEntry = new Entry();
            heightInputEntry.SetSizeRequest(100, 25);
            heightInputEntry.TextInserted += OnlyNumber;
            heightInputEntry.TextInserted += ChangeHeight;
            heightInputEntry.TextDeleted += ChangeHeight;
            fix.Put(heightInputEntry, 80, 70);

            // Buttons
            okButton = new Button();
            okButton.Label = "OK";
            okButton.SetSizeRequest(80, 30);
            okButton.Clicked += okButton_Clicked;
            fix.Put(okButton, 10, 110);

            cancelButton = new Button();
            cancelButton.Label = "Cancel";
            cancelButton.SetSizeRequest(80, 30);
            cancelButton.Clicked += cancelButton_Clicked;
            fix.Put(cancelButton, 110, 110);

            window.Add(fix);
            window.ShowAll();

            widthInputEntry.Text = "" + width;
            heightInputEntry.Text = "" + height;
        }
예제 #16
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;

            string[]    UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse  = new ReverseXmlList(original);

            foreach (XmlNode C in reverse)
            {
                if (C.Name == "Object")
                {
                    cIndex++;
                    if (C.Attributes[0].Name == "type")
                    {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button"))
                        {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        PB.Name = V.InnerText;
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                        PB.Children[0].ModifyFg(StateType.Active, FColor);
                                        PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                        PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                        break;

                                    case "Caption":
                                    case "Text":
                                        PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                        break;

                                    case "BackColor":
                                        var BColor = V.InnerText.GetXColor().ToNative();
                                        PB.ModifyBg(StateType.Normal, BColor);
                                        PB.ModifyBg(StateType.Active, BColor);
                                        PB.ModifyBg(StateType.Insensitive, BColor);
                                        PB.ModifyBg(StateType.Prelight, BColor);
                                        PB.ModifyBg(StateType.Selected, BColor);
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                        break;

                                    case "Image":
                                        if (V.HasChildNodes)
                                        {
                                            string IMGData = V.FirstChild.InnerText;
                                            byte[] B       = System.Convert.FromBase64String(IMGData);
                                            Pixbuf P       = new Pixbuf(B);
                                            P        = P.ScaleSimple(PB.WidthRequest - 10, PB.HeightRequest, InterpType.Bilinear);
                                            PB.Image = new Gtk.Image(P);
                                        }
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label"))
                        {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap     = true;
                            CC.Wrap         = true;
                            CC.Justify      = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild")
                            {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            }
                            else
                            {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        CC.Name = V.InnerText;
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        CC.ModifyFg(StateType.Normal, FColor);
                                        CC.ModifyFg(StateType.Active, FColor);
                                        CC.ModifyFg(StateType.Insensitive, FColor);
                                        CC.ModifyFg(StateType.Prelight, FColor);
                                        CC.ModifyFg(StateType.Selected, FColor);
                                        CE.ModifyFg(StateType.Normal, FColor);
                                        CE.ModifyFg(StateType.Active, FColor);
                                        CE.ModifyFg(StateType.Insensitive, FColor);
                                        CE.ModifyFg(StateType.Prelight, FColor);
                                        CE.ModifyFg(StateType.Selected, FColor);
                                        CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                        break;

                                    case "Caption":
                                    case "Text":
                                        CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                        break;

                                    case "BackColor":
                                        if (V.InnerText != "Transparent")
                                        {
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            CE.ModifyBg(StateType.Normal, BColor);
                                            CE.ModifyBg(StateType.Active, BColor);
                                            CE.ModifyBg(StateType.Insensitive, BColor);
                                            CE.ModifyBg(StateType.Prelight, BColor);
                                            CE.ModifyBg(StateType.Selected, BColor);
                                        }
                                        else
                                        {
                                            CE.Visible       = false;
                                            CE.VisibleWindow = false;
                                        }
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "TextAlign":
                                        CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                        break;

                                    case "Size":
                                        CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    var TZJE = new Fixed();
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox"))
                        {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "PasswordChar":
                                                CC.InvisibleChar = '*';
                                                CC.Visibility    = false;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.Panel"))
                        {
                            var CP = new Gtk.Fixed();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add(CP);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes ["name"].Value)
                                    {
                                    case "Name":
                                        CP.Name = V.InnerText;
                                        break;

                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "ForeColor":

                                        CP.Children [0].ModifyFg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "BackColor":
                                        CP.ModifyBg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        CP.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(C.Attributes ["type"].Value);
                        }
                    }
                }
            }
            Parent.ShowAll();
        }
예제 #17
0
		public void AddPage (Type t, Widget w)
		{
			pages [t] = w;
			HBox h = new HBox (false, 0);
			h.PackStart (new Label (t.ToString ()), false, false, 0);
			Button b = new Button (new Image (close_image));
			b.SetSizeRequest (18, 18);
			
			b.Clicked += delegate {
				shellnotebook.Remove (w);
				pages.Remove (t);
				if (shellnotebook.NPages == 1)
					shellnotebook.ShowTabs = false;
			};
			h.PackStart (b, false, false, 0);
			
			h.ShowAll ();
			shellnotebook.Page = shellnotebook.AppendPage (w, h);
			if (shellnotebook.NPages > 1)
				shellnotebook.ShowTabs = true;
		}
예제 #18
0
        //step 4
        private void Photo()
        {
            //ok, let's check if the user can reach this step, or
            //return to the previous

            Validation.Validator v = new Validation.Validator();
            Contact ct = this.TargetMember.InnerContact;
            v.SetRule(ct.Name, "nombre de contacto", 2, 50);
            v.SetRule(ct.PhoneNumber, "teléfono de contacto", 7, 13, Validation.ValidationRule.Number);
            Validation.ValidationResponse r = v.Run();
            if(!r.Status)
            {
                string s = "";
                for(int i = 0; i < r.Messages.Length; s += r.Messages[i++] + "\n");
                GuiHelper.ShowError(s);
                this.Step -= 1;
                return;
            }

            else if(!(string.IsNullOrEmpty(ct.Name) == string.IsNullOrEmpty(ct.PhoneNumber)))
            {
                GuiHelper.ShowError(this, "Si va a proporcionar los datos de contacto, debe proporcionar ambos");
                this.Step -= 1;
                return;
            }

            //ok, if everything is ok, lets ask for the photo :)
            this.Header = "";
            this.ClearContentBox();
            this.Description = "Introduzca opcionalmente una fotografía para identificar al cliente";

            Button img_button = new Button();
            this.ImageButton = img_button;
            img_button.SetSizeRequest(300, 250);
            img_button.Clicked += this.ChoosePicture;

            if(this.TargetMember.BinImage == null)
                this.CleanImage(null, null);
            else
                this.LoadImage();

            Button clean_button = new Button("Quitar");
            clean_button.Relief = ReliefStyle.None;
            clean_button.Clicked += this.CleanImage;

            LinkButton link = new LinkButton("", "O bien, toma una fotografía");
            link.HasTooltip = false;
            link.FocusOnClick = false;
            link.Clicked += this.TakePicture;

            this.PackWidgetSingle(img_button);
            this.PackWidgetPair(clean_button, link);
            this.ContentVBox.ShowAll();
        }
예제 #19
0
        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.Move(10, 60);
            window.Resize(230, 700);
            window.Title = "Toolbar";
            window.Deletable = false;
            window.ModifyBg(StateType.Normal, new Gdk.Color(182, 195, 205));

            Fixed fix = new Fixed();

            openButton = new Button();
            openButton.Label = "Open Images";
            openButton.SetSizeRequest(100, 30);
            openButton.TooltipText = "Shortcut: " + keymap["open images"].ToString();
            openButton.Name = "open images";
            openButton.Clicked += OperatorButtonClicked;

            saveButton = new Button();
            saveButton.Label = "Save Collage";
            saveButton.SetSizeRequest(100, 30);
            saveButton.TooltipText = "Shortcut: " + keymap["save collage"].ToString();
            saveButton.Name = "save collage";
            saveButton.Clicked += OperatorButtonClicked;

            deleteButton = new Button();
            deleteButton.Label = "Delete";
            deleteButton.SetSizeRequest(100, 30);
            deleteButton.TooltipText = "Shortcut: " + keymap["delete images"].ToString();
            deleteButton.Name = "delete images";
            deleteButton.Clicked += OperatorButtonClicked;

            changeAspectRatioButton = new Button();
            changeAspectRatioButton.Label = "Aspect Ratio";
            changeAspectRatioButton.SetSizeRequest(100, 30);
            changeAspectRatioButton.TooltipText = "Shortcut: " + keymap["change aspect ratio"].ToString();
            changeAspectRatioButton.Name = "change aspect ratio";
            changeAspectRatioButton.Clicked += OperatorButtonClicked;

            autoPositionButton = new Button();
            autoPositionButton.Label = "Auto Position";
            autoPositionButton.SetSizeRequest(100, 30);
            autoPositionButton.TooltipText = "Shortcut: " + keymap["auto position"].ToString();
            autoPositionButton.Name = "auto position";
            autoPositionButton.Clicked += OperatorButtonClicked;

            changeBackgroundColorButton = new Button();
            changeBackgroundColorButton.Label = "Background";
            changeBackgroundColorButton.SetSizeRequest(100, 30);
            changeBackgroundColorButton.TooltipText = "Shortcut: " + keymap["change background color"].ToString();
            changeBackgroundColorButton.Name = "change background color";
            changeBackgroundColorButton.Clicked += OperatorButtonClicked;

            setBackwardButton = new Button();
            setBackwardButton.Label = "Set Backward";
            setBackwardButton.SetSizeRequest(100, 30);
            setBackwardButton.TooltipText = "Shortcut: " + keymap["set backward"].ToString();
            setBackwardButton.Name = "set backward";
            setBackwardButton.Clicked += OperatorButtonClicked;

            setForwardButton = new Button();
            setForwardButton.Label = "Set Forward";
            setForwardButton.SetSizeRequest(100, 30);
            setForwardButton.TooltipText = "Shortcut: " + keymap["set forward"].ToString();
            setForwardButton.Name = "set forward";
            setForwardButton.Clicked += OperatorButtonClicked;

            setAsBackgroundButton = new Button();
            setAsBackgroundButton.Label = "Set Background";
            setAsBackgroundButton.SetSizeRequest(100, 30);
            setAsBackgroundButton.TooltipText = "Shortcut: " + keymap["set as background"].ToString();
            setAsBackgroundButton.Name = "set as background";
            setAsBackgroundButton.Clicked += OperatorButtonClicked;

            setToFrontButton = new Button();
            setToFrontButton.Label = "Set to Front";
            setToFrontButton.SetSizeRequest(100, 30);
            setToFrontButton.TooltipText = "Shortcut: " + keymap["set to front"].ToString();
            setToFrontButton.Name = "set to front";
            setToFrontButton.Clicked += OperatorButtonClicked;

            clearButton = new Button();
            clearButton.Label = "Clear Collage";
            clearButton.SetSizeRequest(100, 30);
            clearButton.TooltipText = "Shortcut: " + keymap["clear collage"].ToString();
            clearButton.Name = "clear collage";
            clearButton.Clicked += OperatorButtonClicked;

            selectAllButton = new Button();
            selectAllButton.Label = "Select All";
            selectAllButton.SetSizeRequest(100, 30);
            selectAllButton.TooltipText = "Shortcut: " + keymap["select all"].ToString();
            selectAllButton.Name = "select all";
            selectAllButton.Clicked += OperatorButtonClicked;

            undoButton = new Button();
            undoButton.Label = "Undo";
            undoButton.SetSizeRequest(100, 30);
            undoButton.TooltipText = "Shortcut: " + keymap["undo"].ToString();
            undoButton.Name = "undo";
            undoButton.Clicked += OperatorButtonClicked;

            redoButton = new Button();
            redoButton.Label = "Redo";
            redoButton.SetSizeRequest(100, 30);
            redoButton.TooltipText = "Shortcut: " + keymap["redo"].ToString();
            redoButton.Name = "redo";
            redoButton.Clicked += OperatorButtonClicked;

            stayOnTopCheckbutton = new CheckButton();
            stayOnTopCheckbutton.Label = "Stay on Top";
            stayOnTopCheckbutton.Toggled += StayOnTopToogled;

            // place objects in window
            fix.Put(openButton, 10, 20); fix.Put(saveButton, 120, 20);
            fix.Put(deleteButton, 10, 55); fix.Put(changeAspectRatioButton, 120, 55);
            fix.Put(autoPositionButton, 10, 90); fix.Put(changeBackgroundColorButton, 120, 90);

            fix.Put(setBackwardButton, 10, 140); fix.Put(setForwardButton, 120, 140);
            fix.Put(setAsBackgroundButton, 10, 175); fix.Put(setToFrontButton, 120, 175);
            fix.Put(clearButton, 10, 210); fix.Put(selectAllButton, 120, 210);

            fix.Put(undoButton, 10, 260); fix.Put(redoButton, 120, 260);

            fix.Put(stayOnTopCheckbutton, 10, 300);

            window.Add(fix);
            window.ShowAll();
        }
예제 #20
0
        void ShowTypeTree(string typeName, bool inverse)
        {
            foreach (object child in notebook.Children) {
                ReferenceTreeViewer tree = child as ReferenceTreeViewer;
                if (tree != null && tree.RootTypeName == typeName) {
                    tree.InverseReferences = inverse;
                    notebook.Page = notebook.PageNum (tree);
                    return;
                }
            }

            ReferenceTreeViewer viewer = new ReferenceTreeViewer ();
            viewer.FillType (GetCurrentObjectMap (), typeName);
            viewer.Show ();
            viewer.TypeActivated += delegate {
                ShowTypeTree (viewer.SelectedType, viewer.InverseReferences);
            };
            HBox label = new HBox ();
            label.Spacing = 3;
            label.PackStart (new Gtk.Image ("class", Gtk.IconSize.Menu), false, false, 0);
            label.PackStart (new Gtk.Label (typeName), true, true, 0);
            Button but = new Button (new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu));
            but.Relief = ReliefStyle.None;
            but.SetSizeRequest (18, 18);
            label.PackStart (but, false, false, 0);
            but.Clicked += delegate {
                notebook.Remove (viewer);
                viewer.Destroy ();
            };
            label.ShowAll ();
            int i = notebook.AppendPage (viewer, label);
            notebook.Page = i;
        }
예제 #21
0
        Widget createDiffWidget(AspectFrame af, AspectFrame af2, PixbufDiff diff)
        {
            VBox sumbox = new VBox ();

            sumbox.Add (createAspectFrame( diff.Diff ));

            Label infotext = new Label (diff.diffstring);
            infotext.LineWrap = true;
            sumbox.Add (infotext);
            Box.BoxChild infotextbc = ((Box.BoxChild)(sumbox [infotext]));
            infotextbc.Expand = false;
            sumbox.Add (new VBox ());

            int mywidth = 24;

            Image arrow = new Image ();
            arrow.Pixbuf = Stetic.IconLoader.LoadIcon (this, "gtk-go-forward", IconSize.LargeToolbar);
            Button button = new Button ();
            button.SetSizeRequest (mywidth, 15);
            button.Add (arrow);
            button.Clicked += (object sender, EventArgs e) => validateImage (diff.Path, af2);
            sumbox.Add (button);
            sumbox.Add (new VBox ());
            Gdk.Pixbuf pixbuf;
            if (af2.Child.Data ["pixbuf"] != null)
                pixbuf = af2.Child.Data ["pixbuf"] as Gdk.Pixbuf;
            else
                pixbuf = af.Child.Data ["pixbuf"] as Gdk.Pixbuf;
            int height = pixbuf.Height;
            int width = pixbuf.Width;
            this.SizeAllocated += (o, args) => {
                int scrollbarwidth = 20;
                sumbox.SetSizeRequest (mywidth, (this.Allocation.Width - mywidth - scrollbarwidth) / 2 * height / width);
            };
            return sumbox;
        }
예제 #22
0
        public MainWindow_Windows()
            : base("Windows")
        {
            SetDefaultSize(300, 250);
            SetPosition(WindowPosition.Center);
            BorderWidth = 15;
            DeleteEvent += delegate
                {
                    if (help != null)
                        help.Clicked -= OnClickedHelpButton;
                    Application.Quit();
                };

            Table table = new Table(8, 4, false);
            table.ColumnSpacing = 3;

            Label title = new Label("Windows");

            Alignment halign = new Alignment(0, 0, 0, 0);
            halign.Add(title);

            table.Attach(halign, 0, 1, 0, 1, AttachOptions.Fill,
                AttachOptions.Fill, 0, 0);

            wins = new TextView();
            wins.ModifyFg(StateType.Normal, new Gdk.Color(20, 20, 20));
            wins.CursorVisible = false;
            table.Attach(wins, 0, 2, 1, 3, AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 1, 1);

            Button activate = new Button("Activate");
            activate.SetSizeRequest(50, 30);
            table.Attach(activate, 3, 4, 1, 2, AttachOptions.Fill,
                AttachOptions.Shrink, 1, 1);

            Alignment valign = new Alignment(0, 0, 0, 0);
            Button close = new Button("Close");
            close.SetSizeRequest(70, 30);
            valign.Add(close);
            table.SetRowSpacing(1, 3);
            table.Attach(valign, 3, 4, 2, 3, AttachOptions.Fill,
                AttachOptions.Fill | AttachOptions.Expand, 1, 1);

            Alignment halign2 = new Alignment(0, 1, 0, 0);
            help = new Button("Help");
            help.SetSizeRequest(70, 30);

            help.Clicked += OnClickedHelpButton;

            halign2.Add(help);
            table.SetRowSpacing(3, 6);
            table.Attach(halign2, 0, 1, 4, 5, AttachOptions.Fill,
                AttachOptions.Fill, 0, 0);

            Button ok = new Button("OK");
            ok.SetSizeRequest(70, 30);
            table.Attach(ok, 3, 4, 4, 5, AttachOptions.Fill,
                AttachOptions.Fill, 0, 0);

            Add(table);
            ShowAll();
        }
예제 #23
0
        private Widget CreateTabLabel(string text)
        {
            Button closeButton = new Button(new Image(closePixbuf));
            closeButton.SetSizeRequest(17,17);
            closeButton.FocusOnClick = false;
            closeButton.CanFocus = false;
            closeButton.Relief = ReliefStyle.None;
            closeButton.Clicked += closeButton_Clicked;

            HBox labelWidget = new HBox();
            labelWidget.PackStart(new Label(text), true, true, 0);
            labelWidget.PackStart(closeButton, true, true, 0);
            labelWidget.CanFocus = false;

            EventBox box = new EventBox();
            box.Add(labelWidget);
            box.ButtonPressEvent += HandleTabButtonPressEvent;

            box.ShowAll();

            return box;
        }
예제 #24
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;
            string[] UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse = new ReverseXmlList(original);

            foreach (XmlNode C in reverse) {
                if (C.Name == "Object") {
                    cIndex++;
                    if (C.Attributes[0].Name == "type") {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            PB.Name = V.InnerText;
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                            PB.Children[0].ModifyFg(StateType.Active, FColor);
                                            PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                            PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                            break;
                                        case "Caption":
                                        case "Text":
                                            PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                            break;
                                        case "BackColor":
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            PB.ModifyBg(StateType.Normal, BColor);
                                            PB.ModifyBg(StateType.Active, BColor);
                                            PB.ModifyBg(StateType.Insensitive, BColor);
                                            PB.ModifyBg(StateType.Prelight, BColor);
                                            PB.ModifyBg(StateType.Selected, BColor);
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                            break;
                                        case "Image":
                                            if (V.HasChildNodes) {
                                                string IMGData = V.FirstChild.InnerText;
                                                byte[] B = System.Convert.FromBase64String(IMGData);
                                                Pixbuf P = new Pixbuf(B);
                                                P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear);
                                                PB.Image = new Gtk.Image(P);
                                            }
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap = true;
                            CC.Wrap = true;
                            CC.Justify = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            } else {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            CC.Name = V.InnerText;
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            CC.ModifyFg(StateType.Normal, FColor);
                                            CC.ModifyFg(StateType.Active, FColor);
                                            CC.ModifyFg(StateType.Insensitive, FColor);
                                            CC.ModifyFg(StateType.Prelight,FColor);
                                            CC.ModifyFg(StateType.Selected, FColor);
                                            CE.ModifyFg(StateType.Normal, FColor);
                                            CE.ModifyFg(StateType.Active, FColor);
                                            CE.ModifyFg(StateType.Insensitive, FColor);
                                            CE.ModifyFg(StateType.Prelight, FColor);
                                            CE.ModifyFg(StateType.Selected, FColor);
                                            CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                            break;
                                        case "Caption":
                                        case "Text":
                                            CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                            break;
                                        case "BackColor":
                                            if (V.InnerText != "Transparent") {
                                                var BColor = V.InnerText.GetXColor().ToNative();
                                                CE.ModifyBg(StateType.Normal, BColor);
                                                CE.ModifyBg(StateType.Active, BColor);
                                                CE.ModifyBg(StateType.Insensitive, BColor);
                                                CE.ModifyBg(StateType.Prelight, BColor);
                                                CE.ModifyBg(StateType.Selected, BColor);
                                            } else {
                                                CE.Visible = false;
                                                CE.VisibleWindow = false;
                                            }
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "TextAlign":
                                            CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                            break;
                                        case "Size":
                                            CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    var TZJE = new Fixed();

                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry ();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC= new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "PasswordChar":
                                                    CC.InvisibleChar = '*';
                                                    CC.Visibility = false;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith ("System.Windows.Forms.Panel")) {
                            var CP = new Gtk.Fixed ();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add (CP);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes ["name"].Value) {
                                        case "Name":
                                            CP.Name = V.InnerText;
                                            break;
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "ForeColor":

                                            CP.Children [0].ModifyFg (StateType.Normal, V.InnerText.GetXColor ().ToNative ());
                                            break;
                                        case "BackColor":
                                            CP.ModifyBg (StateType.Normal, V.InnerText.GetXColor().ToNative ());
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            CP.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else {
                            System.Diagnostics.Debug.WriteLine (C.Attributes ["type"].Value);

                        }
                    }
                }

            }
            Parent.ShowAll();
        }
예제 #25
0
        /// <summary>
        /// Initializes all GUI components.
        /// </summary>
        /// <history>
        /// [Curtis_Beard]      11/03/2006  Created
        /// </history>
        private void InitializeComponent()
        {
            this.SetDefaultSize (Core.GeneralSettings.WindowWidth, Core.GeneralSettings.WindowHeight);
             if (Core.GeneralSettings.WindowLeft == -1 && Core.GeneralSettings.WindowTop == -1)
            this.SetPosition(WindowPosition.Center);
             else
            this.Move(Core.GeneralSettings.WindowLeft, Core.GeneralSettings.WindowTop);

             this.DeleteEvent += new DeleteEventHandler(OnWindowDelete);
             this.Title = Constants.ProductName;
             this.Icon = Images.GetPixbuf("AstroGrep_Icon.ico");

             MainTooltips = new Tooltips();

             VBox vbox = new VBox();
             vbox.BorderWidth = 0;

             Frame leftFrame = new Frame();
             leftFrame.Shadow = ShadowType.In;
             leftFrame.WidthRequest = 200;

             VBox searchBox = new VBox();
             VBox searchOptionsBox = new VBox();
             searchBox.BorderWidth = 3;
             searchOptionsBox.BorderWidth = 3;
             lblSearchStart = new Label("Search Path");
             lblSearchStart.SetAlignment(0,0);

             btnBrowse = new Button();
             btnBrowse.SetSizeRequest(32, 20);
             Gtk.Image img = new Image();
             img.Pixbuf = Images.GetPixbuf("folder-open.png");
             VBox browseBox = new VBox();
             browseBox.PackStart(img, false, false, 0);
             MainTooltips.SetTip(btnBrowse, "Select the folder to start the search", "");
             btnBrowse.Clicked += new EventHandler(btnBrowse_Clicked);
             btnBrowse.Add(browseBox);

             cboSearchStart = ComboBoxEntry.NewText();
             cboSearchFilter = ComboBoxEntry.NewText();
             cboSearchText = ComboBoxEntry.NewText();

             LoadComboBoxEntry(cboSearchStart, Core.GeneralSettings.SearchStarts, true);
             LoadComboBoxEntry(cboSearchFilter, Core.GeneralSettings.SearchFilters, false);
             LoadComboBoxEntry(cboSearchText, Core.GeneralSettings.SearchTexts, false);

             cboSearchStart.Changed += new EventHandler(cboSearchStart_Changed);
             lblSearchFilter = new Label("File Types");
             lblSearchFilter.SetAlignment(0,0);
             lblSearchText = new Label("Search Text");
             lblSearchText.SetAlignment(0,0);

             // search path
             VBox startVBox = new VBox();
             startVBox.BorderWidth = 0;
             cboSearchStart.WidthRequest = 100;
             SetActiveComboBoxEntry(cboSearchStart);

             HBox startHBox = new HBox();
             startHBox.BorderWidth = 0;
             startHBox.PackStart(cboSearchStart, true, true, 0);
             startHBox.PackEnd(btnBrowse, false, false, 0);

             startVBox.PackStart(lblSearchStart, false, false, 0);
             startVBox.PackStart(startHBox, true, false, 0);
             searchBox.PackStart(startVBox, true, false, 0);

             // search filter
             VBox filterVBox = new VBox();
             cboSearchFilter.Active = 0;
             filterVBox.BorderWidth = 0;
             filterVBox.PackStart(lblSearchFilter, false, false, 0);
             filterVBox.PackStart(cboSearchFilter, true, false, 0);
             searchBox.PackStart(filterVBox, true, false, 0);

             // search text
             VBox textVBox = new VBox();
             cboSearchText.Active = 0;
             textVBox.BorderWidth = 0;
             textVBox.PackStart(lblSearchText, false, false, 0);
             textVBox.PackStart(cboSearchText, true, false, 0);
             searchBox.PackStart(textVBox, true, false, 0);

             // Search/Cancel buttons
             searchBox.PackStart(CreateButtons(), false, false, 0);

             // Search Options
             chkRegularExpressions = new CheckButton("Regular Expressions");
             chkCaseSensitive = new CheckButton("Case Sensitive");
             chkWholeWord = new CheckButton("Whole Word");
             chkRecurse = new CheckButton("Recurse");
             chkFileNamesOnly = new CheckButton("Show File Names Only");
             chkFileNamesOnly.Clicked += new EventHandler(chkFileNamesOnly_Clicked);
             chkNegation = new CheckButton("Negation");
             chkNegation.Clicked += new EventHandler(chkNegation_Clicked);
             chkLineNumbers = new CheckButton("Line Numbers");
             cboContextLines = ComboBox.NewText();
             cboContextLines.WidthRequest = 100;
             cboContextLines.WrapWidth = 3;
             for (int i = 0; i <= Constants.MAX_CONTEXT_LINES; i++)
            cboContextLines.AppendText(i.ToString());
             lblContextLines = new Label("Context Lines");
             HBox cxtBox = new HBox();
             cxtBox.BorderWidth = 0;
             cxtBox.PackStart(cboContextLines, false, false, 3);
             cxtBox.PackStart(lblContextLines, false, false, 3);

             searchOptionsBox.PackStart(chkRegularExpressions, true, false, 0);
             searchOptionsBox.PackStart(chkCaseSensitive, true, false, 0);
             searchOptionsBox.PackStart(chkWholeWord, true, false, 0);
             searchOptionsBox.PackStart(chkRecurse, true, false, 0);
             searchOptionsBox.PackStart(chkFileNamesOnly, true, false, 0);
             searchOptionsBox.PackStart(chkNegation, true, false, 0);
             searchOptionsBox.PackStart(chkLineNumbers, true, false, 0);
             searchOptionsBox.PackStart(cxtBox, true, false, 0);
             searchBox.PackEnd(searchOptionsBox, true, true, 0);

             leftFrame.Add(searchBox);

             panelLeft = new HPaned();
             panelLeft.BorderWidth = 0;
             panelRight = new VPaned();
             panelRight.BorderWidth = 0;

             // File List
             Gtk.Frame treeFrame = new Gtk.Frame();
             treeFrame.Shadow = ShadowType.In;
             Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow();
             tvFiles = new Gtk.TreeView ();
             SetColumnsText();

             tvFiles.Model = new ListStore(typeof (string), typeof (string), typeof (string), typeof (string), typeof (int));
             (tvFiles.Model as ListStore).DefaultSortFunc = new TreeIterCompareFunc(DefaultTreeIterCompareFunc);
             tvFiles.Selection.Changed += new EventHandler(Tree_OnSelectionChanged);
             tvFiles.RowActivated += new RowActivatedHandler(tvFiles_RowActivated);

             tvFiles.RulesHint = true;
             tvFiles.HeadersClickable = true;
             tvFiles.HeadersVisible = true;
             tvFiles.Selection.Mode = SelectionMode.Multiple;

             SetSortingFunctions();

             treeWin.Add(tvFiles);
             treeFrame.BorderWidth = 0;
             treeFrame.Add(treeWin);

             // txtHits
             Gtk.Frame ScrolledWindowFrm = new Gtk.Frame();
             ScrolledWindowFrm.Shadow = ShadowType.In;
             Gtk.ScrolledWindow TxtViewWin = new Gtk.ScrolledWindow();
             txtViewer = new Gtk.TextView();
             txtViewer.Buffer.Text = "";
             txtViewer.Editable = false;
             TxtViewWin.Add(txtViewer);
             ScrolledWindowFrm.BorderWidth = 0;
             ScrolledWindowFrm.Add(TxtViewWin);

             // Add file list and txtHits to right panel
             panelRight.Pack1(treeFrame, true, true);
             panelRight.Pack2(ScrolledWindowFrm, true, true);

            // TLW

            //Notebook notebook = new Notebook();
            //    Table table = new Table(3, 6);

            // Create a new notebook, place the position of the tabs
              //  table.attach(notebook, 0, 6, 0, 1);

             // Status Bar
             sbStatus = new Statusbar();

             #region Menu bar

             agMenuAccel = new AccelGroup();
             this.AddAccelGroup(agMenuAccel);

             mbMain = new Gtk.MenuBar();

             // File menu
             mnuFile = new Menu();
             MenuItem mnuFileItem = new MenuItem("_File");
             mnuFileItem.Submenu = mnuFile;
             mnuFile.AccelGroup = agMenuAccel;
             mnuFile.Shown += new EventHandler(mnuFile_Shown);

             // Edit menu
             mnuEdit = new Menu();
             MenuItem mnuEditItem = new MenuItem("_Edit");
             mnuEditItem.Submenu = mnuEdit;
             mnuEdit.AccelGroup = agMenuAccel;
             mnuEdit.Shown += new EventHandler(mnuEdit_Shown);

             // Tools menu
             mnuTools = new Menu();
             MenuItem mnuToolsItem = new MenuItem("_Tools");
             mnuToolsItem.Submenu = mnuTools;
             mnuTools.AccelGroup = agMenuAccel;

             // Help menu
             mnuHelp = new Menu();
             MenuItem mnuHelpItem = new MenuItem("_Help");
             mnuHelpItem.Submenu = mnuHelp;
             mnuHelp.AccelGroup = agMenuAccel;

             // File Save menu item
             SaveMenuItem = new ImageMenuItem(Stock.Save, agMenuAccel);
             SaveMenuItem.Activated += new EventHandler(SaveMenuItem_Activated);
             mnuFile.Append(SaveMenuItem);

             // File Print menu item
             PrintMenuItem = new ImageMenuItem(Stock.Print, agMenuAccel);
             PrintMenuItem.Activated += new EventHandler(PrintMenuItem_Activated);
             mnuFile.Append(PrintMenuItem);

             // File Separator menu item
             SeparatorMenuItem Separator1MenuItem = new SeparatorMenuItem();
             mnuFile.Append(Separator1MenuItem);

             // File Exit menu item
             ExitMenuItem = new ImageMenuItem(Stock.Quit, agMenuAccel);
             ExitMenuItem.Activated += new EventHandler(ExitMenuItem_Activated);
             mnuFile.Append(ExitMenuItem);

             // Edit Select All menu item
             SelectAllMenuItem = new ImageMenuItem("_Select All Files", agMenuAccel);
             SelectAllMenuItem.Activated += new EventHandler(SelectAllMenuItem_Activated);
             mnuEdit.Append(SelectAllMenuItem);

             // Edit Open Selected menu item
             OpenSelectedMenuItem = new ImageMenuItem("_Open Selected Files", agMenuAccel);
             OpenSelectedMenuItem.Activated += new EventHandler(OpenSelectedMenuItem_Activated);
             mnuEdit.Append(OpenSelectedMenuItem);

             // Create preferences for every other os except windows
             if (!Common.IsWindows)
             {
            Separator1MenuItem = new SeparatorMenuItem();
            mnuEdit.Append(Separator1MenuItem);

            // Preferences
            Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem(Stock.Preferences, agMenuAccel);
            OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated);
            mnuEdit.Append(OptionsMenuItem);
             }

             // Clear MRU List
             Gtk.ImageMenuItem ClearMRUsMenuItem = new ImageMenuItem("_Clear Most Recently Used Lists", agMenuAccel);
             ClearMRUsMenuItem.Activated += new EventHandler(ClearMRUsMenuItem_Activated);
             mnuTools.Append(ClearMRUsMenuItem);

             Separator1MenuItem = new SeparatorMenuItem();
             mnuTools.Append(Separator1MenuItem);

             // Save Search Options
             Gtk.ImageMenuItem SaveOptionsMenuItem = new ImageMenuItem("_Save Search Options", agMenuAccel);
             SaveOptionsMenuItem.Activated += new EventHandler(SaveOptionsMenuItem_Activated);
             mnuTools.Append(SaveOptionsMenuItem);

             // Create Options menu for windows
             if (Common.IsWindows)
             {
            // Options menu item
            Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem("_Options...", agMenuAccel);
            OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated);
            OptionsMenuItem.Image = new Gtk.Image(Stock.Preferences, IconSize.Menu);
            mnuTools.Append(OptionsMenuItem);
             }

             // Help About menu item
             MenuItem AboutMenuItem = new ImageMenuItem(Stock.About, agMenuAccel);
             AboutMenuItem.Activated += new EventHandler(AboutMenuItem_Activated);
             mnuHelp.Append(AboutMenuItem);

             // Add the menus to the menubar
             mbMain.Append(mnuFileItem);
             mbMain.Append(mnuEditItem);
             mbMain.Append(mnuToolsItem);
             mbMain.Append(mnuHelpItem);

             // Add the menubar to the Menu panel
             vbox.PackStart(mbMain, false, false, 0);

             #endregion

             // add items to container
             panelLeft.Pack1(leftFrame, true, false);

             // TLW
             //panelLeft.Pack2(tabControl, true, false);
             panelLeft.Pack2(panelRight, true, false);

             // set starting position of splitter
             panelLeft.Position = Core.GeneralSettings.WindowSearchPanelWidth;
             panelRight.Position = Core.GeneralSettings.WindowFilePanelHeight;

             vbox.PackStart(panelLeft, true, true, 0);
             vbox.PackEnd(sbStatus, false, true, 3);

             this.Add (vbox);

             this.ShowAll ();
        }
예제 #26
0
	public Tab(Browser br) 
	{

		browser = br;
		CurrentNode = br.help_tree;
		ShowTabs = false;
		ShowBorder = false;
		TabBorder = 0;
		TabHborder = 0;
		history = new History (browser.back_button, browser.forward_button);
		
		//
		// First Page
		//
		ScrolledWindow html_container = new ScrolledWindow();
		html_container.Show();
		
		//
		// Setup the HTML rendering and preview area
		//

		html = GetRenderer (browser.engine, browser);
		html_preview = GetRenderer (browser.engine, browser);
		if (html == null || html_preview == null)
			throw new Exception ("Couldn't find html renderer!");

		browser.capabilities = html.Capabilities;

		HelpSource.FullHtml = false;
		HelpSource.UseWebdocCache = true;
		if ((html.Capabilities & Capabilities.Css) != 0)
			HelpSource.use_css = true;

		//Prepare Font for css (TODO: use GConf?)
		if ((html.Capabilities & Capabilities.Fonts) != 0 && SettingsHandler.Settings.preferred_font_size == 0) { 
			Pango.FontDescription font_desc = Pango.FontDescription.FromString ("Sans 12");
			SettingsHandler.Settings.preferred_font_family = font_desc.Family;
			SettingsHandler.Settings.preferred_font_size = 100; //size: 100%
		}
		
		html_container.Add (html.HtmlPanel);
		html.UrlClicked += new EventHandler (browser.LinkClicked);
		html.OnUrl += new EventHandler (browser.OnUrlMouseOver);
		browser.context_id = browser.statusbar.GetContextId ("");
		
		AppendPage(html_container, new Label("Html"));
		
		//
		// Second Page: editing
		//
		VBox vbox1 = new VBox(false, 0);
		
		VBox MainPart = new VBox(false, 0);
		
		//
		// TextView for XML code
		//
		ScrolledWindow sw = new ScrolledWindow();
		text_editor = new TextView();
		text_editor.Buffer.Changed += new EventHandler (EditedTextChanged);
		text_editor.WrapMode = WrapMode.Word;
		sw.Add(text_editor);
		text_editor.FocusOutEvent += new FocusOutEventHandler (FocusOut);
		
		//
		// XML editing buttons
		//
		HBox EdBots = new HBox(false, 2);
		Button button1 = new Button("<e_xample>");
		EdBots.PackStart(button1);
		Button button2 = new Button("<list>");
		EdBots.PackStart(button2);
		Button button3 = new Button("<_table>");
		EdBots.PackStart(button3);
		Button button4 = new Button("<_see...>");
		EdBots.PackStart(button4);
		Button button5 = new Button("<_para>");
		EdBots.PackStart(button5);
		Button button6 = new Button("Add Note");
		EdBots.PackStart(button6);
		
		button1.Clicked += new EventHandler (OnInsertExampleClicked);
		button2.Clicked += new EventHandler (OnInsertListClicked);
		button3.Clicked += new EventHandler (OnInsertTableClicked);
		button4.Clicked += new EventHandler (OnInsertType);
		button5.Clicked += new EventHandler (OnInsertParaClicked);
		button6.Clicked += new EventHandler (OnInsertNoteClicked);
		
		Frame html_preview_frame = new Frame("Preview");
		ScrolledWindow html_preview_container = new ScrolledWindow();
		//
		// code preview panel
		//
		html_preview_container.Add (html_preview.HtmlPanel);
		html_preview_frame.Add(html_preview_container);
		
		MainPart.PackStart(sw);
		MainPart.PackStart(EdBots, false, false, 0);
		MainPart.PackStart(html_preview_frame);
		
		//
		// Close and Save buttons
		//
		HBox MainBots = new HBox(false, 3);
		HBox Filling = new HBox(false, 0);
		Button close = new Button("C_lose");
		Button save = new Button("S_ave");
		Button restore = new Button("_Restore");
		
		close.Clicked += new EventHandler (OnCancelEdits);
		save.Clicked += new EventHandler (OnSaveEdits);
		restore.Clicked += new EventHandler (OnRestoreEdits);
		
		MainBots.PackStart(Filling);
		MainBots.PackStart(close, false, false, 0);
		MainBots.PackStart(save, false, false, 0);
		MainBots.PackStart(restore, false, false, 0);
		
		vbox1.PackStart(MainPart);
		vbox1.PackStart(MainBots, false, false, 0);
		
		AppendPage(vbox1, new Label("Edit XML"));
		
		//
		//Create the Label for the Tab
		//
		TabLabel = new HBox(false, 2);
		
		titleLabel = new Label("");
		
		//Close Tab button
		Button tabClose = new Button();
		Image img = new Image(Stock.Close, IconSize.SmallToolbar);
		tabClose.Add(img);
		tabClose.Relief = Gtk.ReliefStyle.None;
		tabClose.SetSizeRequest (18, 18);
		tabClose.Clicked += new EventHandler (browser.OnCloseTab);
		
		//Icon showed when the Tab is in Edit Mode
		EditImg = new Image (Stock.Convert, IconSize.SmallToolbar);
		
		TabLabel.PackStart (EditImg, false, true, 2);
		TabLabel.PackStart (titleLabel, true, true, 0);
		TabLabel.PackStart (tabClose, false, false, 2);
		
		// needed, otherwise even calling show_all on the notebook won't
		// make the hbox contents appear.
		TabLabel.ShowAll();
		EditImg.Visible = false;
	
	}
예제 #27
0
    void makeimwindow(string name,ChatConsole cs,bool group,UUID target)
    {
        Gtk.Image image=new Gtk.Image(MainClass.GetResource("closebox.png"));
        image.HeightRequest=16;
        image.WidthRequest=16;

        Gtk.Image icon;

        if(group)
            icon=new Gtk.Image(MainClass.GetResource("icon_group.png"));
        else
            icon=new Gtk.Image(MainClass.GetResource("icn_voice-groupfocus.png"));

        image.SetSizeRequest(16,16);
        Gtk.Label lable=new Gtk.Label(name);
        Gtk.Button button=new Gtk.Button(image);
        button.SetSizeRequest(16,16);
        Gtk.HBox box=new Gtk.HBox();
        box.PackStart(icon);
        box.PackStart(lable);
        box.PackStart(button);
        box.SetChildPacking(image,false,false,0,PackType.Start);

        box.ShowAll();
        notebook.InsertPage(cs,box,-1);
        notebook.ShowAll();
        cs.tabLabel=lable;
        AsyncNameUpdate ud;

        if(target!=UUID.Zero)
        {
            if(group)
                ud=new AsyncNameUpdate(target,true);
            else
                ud=new AsyncNameUpdate(target,false);

            ud.onNameCallBack += delegate(string namex,object [] values){cs.tabLabel.Text=namex;};
            ud.go();
        }

        button.Clicked += new EventHandler(cs.clickclosed);
        this.notebook.SwitchPage += new SwitchPageHandler(cs.onSwitchPage);
    }
예제 #28
0
        public void Load(Summa.Data.Item item)
        {
            HBox container = new HBox();
            Label label = new Label(item.Title);
            container.PackStart(label);
            Button button = new Button(new Image(IconTheme.Default.LookupIcon("gtk-close", 16, IconLookupFlags.NoSvg).LoadIcon()));
            button.Clicked += OnClicked;
            button.Relief = ReliefStyle.None;
            button.SetSizeRequest(20, 20);
            container.PackEnd(button);

            WebKitView view = new WebKitView();
            view.notebook = this;
            ScrolledWindow view_swin = new ScrolledWindow(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0));
            view_swin.Add(view);
            view_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            view.Render(item);

            hash.Add(container, view);

            AppendPage(view_swin, container);
            container.ShowAll();

            ShowAll();
            if ( NPages > 1 ) {
                ShowTabs = true;
            } else {
                ShowTabs = false;
            }
        }