Example #1
0
		public ClipBox(Manager manager)
			: base(manager) {
			Color = Color.Transparent;
			BackColor = Color.Transparent;
			CanFocus = false;
			Passive = true;
		}
Example #2
0
		public SideBarPanel(Manager manager)
			: base(manager) {
			CanFocus = false;
			Passive = true;
			Width = 64;
			Height = 64;
		}
Example #3
0
		public Skin(Manager manager, string name)
			: base(manager) {
			this.name = name;
			content = new ArchiveManager(Manager.Game.Services, GetArchiveLocation(name + Manager.SkinExtension));
			content.RootDirectory = GetFolder();
			doc = new SkinXmlDocument();
			controls = new SkinList<SkinControl>();
			fonts = new SkinList<SkinFont>();
			images = new SkinList<SkinImage>();
			cursors = new SkinList<SkinCursor>();
			attributes = new SkinList<SkinAttribute>();

			LoadSkin(null, content.UseArchive);

			string folder = GetAddonsFolder();
			if (folder == "") {
				content.UseArchive = true;
				folder = "Addons\\";
			} else {
				content.UseArchive = false;
			}

			string[] addons = content.GetDirectories(folder);

			if (addons != null && addons.Length > 0) {
				for (int i = 0; i < addons.Length; i++) {
					DirectoryInfo d = new DirectoryInfo(GetAddonsFolder() + addons[i]);
					if (!((d.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) || content.UseArchive) {
						LoadSkin(addons[i].Replace("\\", ""), content.UseArchive);
					}
				}
			}
		}
Example #4
0
		public Window(Manager manager)
			: base(manager) {
			CheckLayer(Skin, lrWindow);
			CheckLayer(Skin, lrCaption);
			CheckLayer(Skin, lrFrameTop);
			CheckLayer(Skin, lrFrameLeft);
			CheckLayer(Skin, lrFrameRight);
			CheckLayer(Skin, lrFrameBottom);
			CheckLayer(Manager.Skin.Controls[skButton], lrButton);
			CheckLayer(Manager.Skin.Controls[skShadow], lrShadow);

			SetDefaultSize(640, 480);
			SetMinimumSize(100, 75);

			btnClose = new Button(manager);
			btnClose.Skin = new SkinControl(Manager.Skin.Controls[skButton]);
			btnClose.Init();
			btnClose.Detached = true;
			btnClose.CanFocus = false;
			btnClose.Text = null;
			btnClose.Click += new EventHandler(btnClose_Click);
			btnClose.SkinChanged += new EventHandler(btnClose_SkinChanged);

			AdjustMargins();

			AutoScroll = true;
			Movable = true;
			Resizable = true;
			Center();

			Add(btnClose, false);

			oldAlpha = Alpha;
		}
Example #5
0
		public CheckBox(Manager manager)
			: base(manager) {
			CheckLayer(Skin, lrChecked);

			Width = 64;
			Height = 16;
		}
Example #6
0
		private static Control LoadControl(Manager manager, XmlNode node, Type type, Control parent) {
			Control c = null;

			Object[] args = new Object[] { manager };

			c = (Control)type.InvokeMember(null, BindingFlags.CreateInstance, null, null, args);
			if (parent != null)
				c.Parent = parent;
			c.Name = node.Attributes["Name"].Value;

			if (node != null && node["Properties"] != null && node["Properties"].HasChildNodes) {
				LoadProperties(node["Properties"].GetElementsByTagName("Property"), c);
			}

			if (node != null && node["Controls"] != null && node["Controls"].HasChildNodes) {
				foreach (XmlElement e in node["Controls"].GetElementsByTagName("Control")) {
					string cls = e.Attributes["Class"].Value;
					Type t = Type.GetType(cls);

					if (t == null) {
						cls = "GodLesZ.Library.Xna.WindowLibrary.Controls." + cls;
						t = Type.GetType(cls);
					}
					LoadControl(manager, e, t, c);
				}
			}

			return c;
		}
Example #7
0
		public Label(Manager manager)
			: base(manager) {
			CanFocus = false;
			Passive = true;
			Width = 64;
			Height = 16;
		}
Example #8
0
		public Component(Manager manager) {
			if (manager == null) {
				throw new Exception("Component cannot be created. Manager instance is needed.");
			}

			mManager = manager;
		}
Example #9
0
		public ContextMenu(Manager manager)
			: base(manager) {
			Visible = false;
			Detached = true;
			StayOnBack = true;

			Manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown);
		}
Example #10
0
		public StatusBar(Manager manager)
			: base(manager) {
			Left = 0;
			Top = 0;
			Width = 64;
			Height = 24;
			CanFocus = false;
		}
Example #11
0
		public Panel(Manager manager)
			: base(manager) {
			Passive = false;
			CanFocus = false;
			Width = 64;
			Height = 64;

			bevel = new Bevel(Manager);
		}
Example #12
0
		public MainMenu(Manager manager)
			: base(manager) {
			Left = 0;
			Top = 0;
			Height = 24;
			Detached = false;
			DoubleClicks = false;
			StayOnBack = true;
		}
Example #13
0
		public ScrollBar(Manager manager, EOrientation orientation)
			: base(manager) {
			this.orientation = orientation;
			CanFocus = false;


			if (orientation == EOrientation.Horizontal) {
				strButton = "ScrollBar.ButtonHorz";
				strRail = "ScrollBar.RailHorz";
				strSlider = "ScrollBar.SliderHorz";
				strGlyph = "ScrollBar.GlyphHorz";
				strMinus = "ScrollBar.ArrowLeft";
				strPlus = "ScrollBar.ArrowRight";

				MinimumHeight = 16;
				MinimumWidth = 46;
				Width = 64;
				Height = 16;
			} else {
				strButton = "ScrollBar.ButtonVert";
				strRail = "ScrollBar.RailVert";
				strSlider = "ScrollBar.SliderVert";
				strGlyph = "ScrollBar.GlyphVert";
				strMinus = "ScrollBar.ArrowUp";
				strPlus = "ScrollBar.ArrowDown";

				MinimumHeight = 46;
				MinimumWidth = 16;
				Width = 16;
				Height = 64;
			}

			btnMinus = new Button(Manager);
			btnMinus.Init();
			btnMinus.Text = "";
			btnMinus.MousePress += new MouseEventHandler(ArrowPress);
			btnMinus.CanFocus = false;

			btnSlider = new Button(Manager);
			btnSlider.Init();
			btnSlider.Text = "";
			btnSlider.CanFocus = false;
			btnSlider.MinimumHeight = 16;
			btnSlider.MinimumWidth = 16;

			btnPlus = new Button(Manager);
			btnPlus.Init();
			btnPlus.Text = "";
			btnPlus.MousePress += new MouseEventHandler(ArrowPress);
			btnPlus.CanFocus = false;

			btnSlider.Move += new MoveEventHandler(btnSlider_Move);

			Add(btnMinus);
			Add(btnSlider);
			Add(btnPlus);
		}
Example #14
0
		public ProgressBar(Manager manager)
			: base(manager) {
			Width = 128;
			Height = 16;
			MinimumHeight = 8;
			MinimumWidth = 32;
			Passive = true;
			CanFocus = false;
		}
Example #15
0
		public GroupBox(Manager manager)
			: base(manager) {
			CheckLayer(Skin, "Control");
			CheckLayer(Skin, "Flat");

			CanFocus = false;
			Passive = true;
			Width = 64;
			Height = 64;
			BackColor = Color.Transparent;
		}
Example #16
0
		public Console(Manager manager)
			: base(manager) {
			Width = 320;
			Height = 160;
			MinimumHeight = 64;
			MinimumWidth = 64;
			CanFocus = false;

			Resizable = false;
			Movable = false;

			cmbMain = new ComboBox(manager);
			cmbMain.Init();
			cmbMain.Top = Height - cmbMain.Height;
			cmbMain.Left = 0;
			cmbMain.Width = 128;
			cmbMain.Anchor = EAnchors.Left | EAnchors.Bottom;
			cmbMain.Detached = false;
			cmbMain.DrawSelection = false;
			cmbMain.Visible = channelsVisible;
			Add(cmbMain, false);

			txtMain = new TextBox(manager);
			txtMain.Init();
			txtMain.Top = Height - txtMain.Height;
			txtMain.Left = cmbMain.Width + 1;
			txtMain.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			txtMain.Detached = false;
			txtMain.Visible = textBoxVisible;
			txtMain.KeyDown += new KeyEventHandler(txtMain_KeyDown);
			txtMain.GamePadDown += new GamePadEventHandler(txtMain_GamePadDown);
			txtMain.FocusGained += new EventHandler(txtMain_FocusGained);
			Add(txtMain, false);

			sbVert = new ScrollBar(manager, EOrientation.Vertical);
			sbVert.Init();
			sbVert.Top = 2;
			sbVert.Left = Width - 18;
			sbVert.Anchor = EAnchors.Right | EAnchors.Top | EAnchors.Bottom;
			sbVert.Range = 1;
			sbVert.PageSize = 1;
			sbVert.Value = 0;
			sbVert.ValueChanged += new EventHandler(sbVert_ValueChanged);
			Add(sbVert, false);

			ClientArea.Draw += new DrawEventHandler(ClientArea_Draw);

			buffer.ItemAdded += new EventHandler(buffer_ItemAdded);
			channels.ItemAdded += new EventHandler(channels_ItemAdded);
			channels.ItemRemoved += new EventHandler(channels_ItemRemoved);

			PositionControls();
		}
Example #17
0
		public ClipControl(Manager manager)
			: base(manager) {
			clientArea = new ClipBox(manager);
			clientArea.Name = "clientArea";
			clientArea.Init();
			clientArea.MinimumWidth = 0;
			clientArea.MinimumHeight = 0;
			clientArea.Left = ClientLeft;
			clientArea.Top = ClientTop;
			clientArea.Width = ClientWidth;
			clientArea.Height = ClientHeight;

			base.Add(clientArea);
		}
Example #18
0
		public TrackBar(Manager manager)
			: base(manager) {
			Width = 64;
			Height = 20;
			CanFocus = false;

			btnSlider = new Button(Manager);
			btnSlider.Init();
			btnSlider.Text = "";
			btnSlider.CanFocus = true;
			btnSlider.Parent = this;
			btnSlider.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Bottom;
			btnSlider.Detached = true;
			btnSlider.Movable = true;
			btnSlider.Move += new MoveEventHandler(btnSlider_Move);
			btnSlider.KeyPress += new KeyEventHandler(btnSlider_KeyPress);
			btnSlider.GamePadPress += new GamePadEventHandler(btnSlider_GamePadPress);
		}
Example #19
0
		public static Container Load(Manager manager, string asset) {
			Container win = null;
			LayoutXmlDocument doc = new LayoutXmlDocument();
			ArchiveManager content = new ArchiveManager(manager.Game.Services);

			try {
				content.RootDirectory = manager.LayoutDirectory;

#if (!XBOX && !XBOX_FAKE)

				string file = content.RootDirectory + asset;

				if (File.Exists(file)) {
					doc.Load(file);
				} else

#endif
 {
					doc = content.Load<LayoutXmlDocument>(asset);
				}


				if (doc != null && doc["Layout"]["Controls"] != null && doc["Layout"]["Controls"].HasChildNodes) {
					XmlNode node = doc["Layout"]["Controls"].GetElementsByTagName("Control").Item(0);
					string cls = node.Attributes["Class"].Value;
					Type type = Type.GetType(cls);

					if (type == null) {
						cls = "GodLesZ.Library.Xna.WindowLibrary.Controls." + cls;
						type = Type.GetType(cls);
					}

					win = (Container)LoadControl(manager, node, type, null);
				}

			} finally {
				content.Dispose();
			}

			return win;
		}
Example #20
0
		public ComboBox(Manager manager)
			: base(manager) {
			Height = 20;
			Width = 64;
			ReadOnly = true;

			btnDown = new Button(Manager);
			btnDown.Init();
			btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]);
			btnDown.CanFocus = false;
			btnDown.Click += new EventHandler(btnDown_Click);
			Add(btnDown, false);

			lstCombo = new ListBox(Manager);
			lstCombo.Init();
			lstCombo.HotTrack = true;
			lstCombo.Detached = true;
			lstCombo.Visible = false;
			lstCombo.Click += new EventHandler(lstCombo_Click);
			lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost);
			lstCombo.Items = items;
			manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown);
		}
Example #21
0
		public Control(Manager manager)
			: this(manager, false) {
		}
Example #22
0
		public MenuBase(Manager manager)
			: base(manager) {
			rootMenu = this;
		}
Example #23
0
		public RadioButton(Manager manager)
			: base(manager) {
		}
Example #24
0
		public Container(Manager manager)
			: base(manager) {
			sbVert = new ScrollBar(manager, EOrientation.Vertical);
			sbVert.Init();
			sbVert.Detached = false;
			sbVert.Anchor = EAnchors.Top | EAnchors.Right | EAnchors.Bottom;
			sbVert.ValueChanged += new EventHandler(ScrollBarValueChanged);
			sbVert.Range = 0;
			sbVert.PageSize = 0;
			sbVert.Value = 0;
			sbVert.Visible = false;

			sbHorz = new ScrollBar(manager, EOrientation.Horizontal);
			sbHorz.Init();
			sbHorz.Detached = false;
			sbHorz.Anchor = EAnchors.Right | EAnchors.Left | EAnchors.Bottom;
			sbHorz.ValueChanged += new EventHandler(ScrollBarValueChanged);
			sbHorz.Range = 0;
			sbHorz.PageSize = 0;
			sbHorz.Value = 0;
			sbHorz.Visible = false;

			Add(sbVert, false);
			Add(sbHorz, false);
		}
Example #25
0
		public InputSystem(Manager manager)
			: this(manager, new InputOffset(0, 0, 1.0f, 1.0f)) {
		}
Example #26
0
		public InputSystem(Manager manager, InputOffset offset) {
			this.inputOffset = offset;
			this.manager = manager;
#if (!XBOX && !XBOX_FAKE)
			window = manager.Window;
#endif
		}
Example #27
0
		public ModalContainer(Manager manager)
			: base(manager) {
			Manager.Input.GamePadDown += new GamePadEventHandler(Input_GamePadDown);
			GamePadActions = new EWindowGamePadActions();
		}
Example #28
0
		public StackPanel(Manager manager, EOrientation orientation)
			: base(manager) {
			this.orientation = orientation;
			this.Color = Color.Transparent;
		}
Example #29
0
		public Control(Manager manager, bool autoInit)
			: base(manager) {
			if (Manager == null) {
				throw new Exception("Control cannot be created. Manager instance is needed.");
			} else if (Manager.Skin == null) {
				throw new Exception("Control cannot be created. No skin loaded.");
			}

			text = Utilities.DeriveControlName(this);
			root = this;

			InitSkin();

			CheckLayer(skin, "Control");

			if (Skin != null) {
				SetDefaultSize(width, height);
				SetMinimumSize(MinimumWidth, MinimumHeight);
				ResizerSize = skin.ResizerSize;
			}

			Stack.Add(this);


			mAutoInit = autoInit;
			if (AutoInit) {
				Init();
			}
		}
Example #30
0
		public ToolTip(Manager manager)
			: base(manager) {
			Text = "";
		}