public TextNDropTestDialog()
            : base("TextField and DropList Test", 200, 200, 320, 200)
        {
            girdLayout = new GirdLayout(4, 1);
            girdLayout.Right = 16;
            girdLayout.Left = 16;
            girdLayout.Top = 8;
            girdLayout.Bottom = 8;
            girdLayout.Spacer = 4;

            girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HLeft);
            girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight);

            closeButton = new Button("Close");
            //textField=new TextField(160);
            dropList = new DropList();
            option1 = new DropListItem("Option one");
            option2 = new DropListItem("Option Two");
            option3 = new DropListItem("Option Three");
            dropList.Add(option1);
            dropList.Add(option2);
            dropList.Add(option3);

            textLabel = new Label("Text input here:");
            optionLabel = new Label("Drop List test:");

            Layout = girdLayout;

            Add(textLabel);
            //Add(textField);
            Add(optionLabel);
            Add(dropList);
            Add(closeButton);

            Pack();

            closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
        }
Пример #2
0
        public DialogTestDialog()
            : base("Dialog Test", 500, 500, 260, 180)
        {
            girdLayout = new GirdLayout(4, 1);
            
            girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HLeft);
            girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight);

            girdLayout.Right = 16;
            girdLayout.Left = 16;
            girdLayout.Top = 8;
            girdLayout.Bottom = 8;
            girdLayout.Spacer = 4;

            closeButton = new Button("Close");
            //closeButton.HorizontalStyle = EElementStyle.Stretch;

            dragAble = new CheckButton("Dragable", true);
            SizeAble = new CheckButton("Resizable", true);

            label = new Label("This is a modal dialog.");

            Layout = girdLayout;

            Add(label);
            Add(dragAble);
            Add(SizeAble);
            Add(closeButton);

            Pack();

            closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
            dragAble.MousePressedEvent += new MousePressedHandler(dragAble_MousePressedEvent);
            SizeAble.MousePressedEvent += new MousePressedHandler(SizeAble_MousePressedEvent);
        }
Пример #3
0
        public override void PaintLabel(Label component)
        {
            Position origin = UI.Instance.GetOrigin();

            if (component.IsDrawBackground())
            {
                GL.Color3(0, 0, 0);
                GL.Begin(BeginMode.Quads);
                GL.Vertex2(origin.X + component.Position.X, origin.Y + component.Position.Y);
                GL.Vertex2(origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y);
                GL.Vertex2(origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y + component.Size.height);
                GL.Vertex2(origin.X + component.Position.X, origin.Y + component.Position.Y + component.Size.height);
                GL.End();
            }
            GL.Color3(1f, 1f, 1f);

            component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X);
            component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 2);
            component.textFont.Render(true);
        }
Пример #4
0
 public override Size GetLabelPreferedSize(Label component)
 {
     UI.Instance.CurrentTheme.defaultTextFont.MeasureString(component.Text, out w, out h);
     return new Size(component.Right + component.Left + (uint)w, 20);
 }
Пример #5
0
 public abstract void PaintLabel(Label component);
Пример #6
0
 public abstract Size GetLabelPreferedSize(Label component);
Пример #7
0
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            if (text == null)
                text = "";

            if (caption == null)
                caption = "";

            MessageBox mymb = new MessageBox(caption);

            mymb.mymb = mymb;

            // ensure we are always in a known state
            _state = DialogResult.None;

            // convert to nice wrapped lines.
            text = AddNewLinesToText(text);
            // get pixel width and height

            Graphics graphics = Graphics.FromImage(new Bitmap(1, 1));

            SizeF textSize = graphics.MeasureString(text, SystemFonts.DefaultFont);

            textSize = new SizeF(textSize.Width * 3, textSize.Height * 1);
            // allow for icon
              //          if (icon != MessageBoxIcon.None)
            //                textSize.Width += SystemIcons.Question.Width;

            mymb.Size = new AssortedWidgets.Util.Size(textSize.Width + 50, textSize.Height + 100);

            //Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
            //int titleHeight = screenRectangle.Top - msgBoxFrm.Top;

            var lblMessage = new Label(text);

            var actualIcon = getMessageBoxIcon(icon);

            if (actualIcon == null)
            {
             //   lblMessage.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
            }
            else
            {
             //   var iconPbox = new PictureBox
                {
              //      Image = actualIcon.ToBitmap(),
              //      Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN)
                };
              //  msgBoxFrm.Controls.Add(iconPbox);
            }

            mymb.Add(lblMessage);

            //mymb.Add(actualIcon);

            AddButtonsToForm(mymb, buttons);

            mymb.Pack();

            DialogManager.Instance.SetModalDialog(mymb);

            DialogResult answer = _state;

            return answer;
        }
        public ProgressNSliderTestDialog()
            : base("Progress and Slider Test", 150, 150, 320, 200)
        {
            /*
			borderLayout=new BorderLayout(16,16,16,16,8);
			borderLayout.SouthHAlignment = EHorizontalAlignment.HRight;

			closeButton=new Button("Close");
			closeButton.LayoutProperty = EArea.South;

			valueLabel=new Label("Value:0%");
			valueLabel.LayoutProperty = EArea.North;

			centerPanel=new Panel();
			centerGirdLayout=new GirdLayout(2,1);
			centerPanel.Layout = centerGirdLayout;

			horizontalPBar=new ProgressBar(0.0f,100.0f,0.0f);
			horizontalSBar=new SlideBar(0.0f,100.0f,0.0f);

			centerPanel.Add(horizontalPBar);
			centerPanel.Add(horizontalSBar);
			centerPanel.LayoutProperty = EArea.Center;
			centerPanel.Pack();

			verticalPBar=new ProgressBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);
			verticalSBar=new SlideBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);

			verticalPBar.LayoutProperty = EArea.East;
            verticalSBar.LayoutProperty = EArea.East;

			Add(closeButton);
			Add(valueLabel);
			Add(centerPanel);
			Add(verticalPBar);
			Add(verticalSBar);

			Layout = borderLayout;

			Pack();
            */

            girdLayout = new GirdLayout(4, 1);

            girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HLeft);
            girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight);

            girdLayout.Right = 16;
            girdLayout.Left = 16;
            girdLayout.Top = 8;
            girdLayout.Bottom = 8;
            girdLayout.Spacer = 4;

            closeButton = new Button("Close");
            closeButton.LayoutProperty = EArea.South;

            valueLabel = new Label("Value: 0%");
            valueLabel.LayoutProperty = EArea.North;

            horizontalPBar = new ProgressBar(0.0f, 100.0f, ETypeOrientation.Horizontal);
            horizontalSBar = new SlideBar(0.0f, 100.0f, ETypeOrientation.Horizontal);

            Button button1 = new Button("button1");
            Button button2 = new Button("button2");

            Add(valueLabel);
            Add(horizontalPBar);
            Add(horizontalSBar);
            //Add(button1);
            //Add(button2);
            Add(closeButton);

            Layout = girdLayout;

            Pack();

            horizontalSBar.Slider.DragMovedEvent += new DragMovedHandler(Slider_DragMovedEvent);
            closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
        }
        public MultipleLayoutTestDialog()
            : base("MultipleLayout Test", 350, 350, 400, 180)
        {
			girdLayout=new GirdLayout(1,2);
			girdLayout.Right = 16;
			girdLayout.Left = 16;
			girdLayout.Top = 8;
			girdLayout.Bottom = 8;
			girdLayout.Spacer = 4;

			flowLayout=new FlowLayout(2,2,2,2,4);			

			TheLabel=new Label("The");
			TheLabel.SetDrawBackground(true);

			quickLabel=new Label("quick");
			quickLabel.SetDrawBackground(true);

			brownLabel=new Label("brown");
			brownLabel.SetDrawBackground(true);

			foxLabel=new Label("Fox");
			foxLabel.SetDrawBackground(true);

			jumpsLabel=new Label("jumps");
			jumpsLabel.SetDrawBackground(true);

			overLabel=new Label("over");
			overLabel.SetDrawBackground(true);

			theLabel=new Label("a");
			theLabel.SetDrawBackground(true);

			lazyDogLabel=new Label("lazy dog.");
			lazyDogLabel.SetDrawBackground(true);

			flowPanel=new Panel();
			flowPanel.Layout = flowLayout;
			flowPanel.Add(TheLabel);
			flowPanel.Add(quickLabel);
			flowPanel.Add(brownLabel);
			flowPanel.Add(foxLabel);
			flowPanel.Add(jumpsLabel);
			flowPanel.Add(overLabel);
			flowPanel.Add(theLabel);
			flowPanel.Add(lazyDogLabel);
		
			flowPanel.Pack();

			borderLayout=new BorderLayout(2,2,2,2,4);
			closeButton=new Button("Close");
			closeButton.LayoutProperty = EArea.South;

			northLabel=new Label("North");
			northLabel.HorizontalStyle = EElementStyle.Stretch;
			northLabel.SetDrawBackground(true);
			northLabel.LayoutProperty = EArea.North;

			southLabel=new Label("South");
			southLabel.HorizontalStyle = EElementStyle.Stretch;
			southLabel.SetDrawBackground(true);
			southLabel.LayoutProperty = EArea.South;

			westLabel=new Label("West");
			westLabel.VerticalStyle = EElementStyle.Stretch;
			westLabel.SetDrawBackground(true);
			westLabel.LayoutProperty = EArea.West;

			eastLabel=new Label("East");
			eastLabel.VerticalStyle = EElementStyle.Stretch;
			eastLabel.SetDrawBackground(true);
			eastLabel.LayoutProperty = EArea.East;

			centerLabel=new Label("Center");
			centerLabel.HorizontalStyle = EElementStyle.Stretch;
            centerLabel.VerticalStyle = EElementStyle.Stretch;
			centerLabel.SetDrawBackground(true);
			centerLabel.LayoutProperty = EArea.Center;

			borderPanel=new Panel();
			borderPanel.Layout = borderLayout;

			borderPanel.Add(northLabel);
			borderPanel.Add(southLabel);
			borderPanel.Add(closeButton);
			borderPanel.Add(westLabel);
			borderPanel.Add(eastLabel);
			borderPanel.Add(centerLabel);

			borderPanel.Pack();
			
			Layout = girdLayout;
			Add(flowPanel);
			Add(borderPanel);
			Pack();

            closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
        }