/// <summary> /// Initializes a new instance of the <see cref="Label"/> class with the specified text. /// </summary> /// <param name="text">The specified text for this <see cref="Label"/>.</param> public Label(string text) { IntPtr strPtr = text.ToLibuiString(); Handle = new SafeControlHandle(LibuiLibrary.uiNewLabel(strPtr)); Marshal.FreeHGlobal(strPtr); this.text = text; }
public SpinBox(int min, int max) { Handle = new SafeControlHandle(LibuiLibrary.uiNewSpinbox(min, max)); MinimumValue = min; MaximumValue = max; InitializeEvents(); }
public GroupBox(string title) { IntPtr strPtr = title.ToLibuiString(); Handle = new SafeControlHandle(LibuiLibrary.uiNewGroup(strPtr)); Marshal.FreeHGlobal(strPtr); }
public DateTimePicker() { if (!(this is DatePicker || this is TimePicker)) { Handle = new SafeControlHandle(LibuiLibrary.uiNewDateTimePicker()); } InitializeEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="Button"/> class with the specified text. /// </summary> /// <param name="text">The text to be displayed by this button.</param> public Button(string text) { IntPtr strPtr = text.ToLibuiString(); Handle = new SafeControlHandle(LibuiLibrary.uiNewButton(strPtr)); Marshal.FreeHGlobal(strPtr); this.text = text; InitializeEvents(); }
public MenuStrip(string name) { IntPtr strPtr = name.ToLibuiString(); Handle = new SafeControlHandle(LibuiLibrary.uiNewMenu(strPtr)); Marshal.FreeHGlobal(strPtr); Name = name; Items = new List <MenuStripItem>(); }
/// <summary> /// Initializes a new instance of the <see cref="CheckBox"/> class with the specified text. /// </summary> /// <param name="text">The text specified by the <see cref="CheckBox"/>.</param> public CheckBox(string text) { IntPtr strPtr = LibuiLibrary.UTF8Helper.ToUTF8Ptr(text); Handle = new SafeControlHandle(LibuiLibrary.uiNewCheckbox(strPtr)); Marshal.FreeHGlobal(strPtr); this.text = text; InitializeEvents(); }
protected ComboBoxBase() { if (this is ComboBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewCombobox()); } else if (this is EditableComboBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewEditableCombobox()); } }
public MultilineTextBox(bool wordWrap = true) { if (wordWrap) { Handle = new SafeControlHandle(LibuiLibrary.uiNewMultilineEntry()); } else { Handle = new SafeControlHandle(LibuiLibrary.uiNewNonWrappingMultilineEntry()); } WordWrap = wordWrap; InitializeEvents(); }
protected SurfaceBase(ISurfaceHandler events) { SurfaceHandler surfaceEvents = new SurfaceHandler { Draw = (IntPtr surfaceHandler, IntPtr surface, ref LibuiLibrary.uiAreaDrawParams args) => { SafeControlHandle surfaceHandle = new SafeControlHandle(surface); SurfaceBase realSurface = Surfaces[surfaceHandle]; DrawEventArgs a = args.ToDrawEventArgs(); events.Draw(realSurface, ref a); }, MouseEvent = (IntPtr surfaceHandler, IntPtr surface, ref LibuiLibrary.uiAreaMouseEvent args) => { SafeControlHandle surfaceHandle = new SafeControlHandle(surface); SurfaceBase realSurface = Surfaces[surfaceHandle]; MouseEventArgs a = args.ToMouseEventArgs(); events.MouseEvent(realSurface, ref a); }, MouseCrossed = (surfaceHandler, surface, left) => { SafeControlHandle surfaceHandle = new SafeControlHandle(surface); SurfaceBase realSurface = Surfaces[surfaceHandle]; MouseCrossedEventArgs a = new MouseCrossedEventArgs(left); events.MouseCrossed(realSurface, a); }, DragBroken = (surfaceHandler, surface) => { SafeControlHandle surfaceHandle = new SafeControlHandle(surface); SurfaceBase realSurface = Surfaces[surfaceHandle]; events.DragBroken(realSurface); }, KeyEvent = (IntPtr surfaceHandler, IntPtr surface, ref LibuiLibrary.uiAreaKeyEvent args) => { SafeControlHandle surfaceHandle = new SafeControlHandle(surface); SurfaceBase realSurface = Surfaces[surfaceHandle]; KeyEventArgs a = args.ToKeyEventArgs(); return(events.KeyEvent(realSurface, ref a)); } }; EventHandler = new LibuiLibrary.uiAreaHandler { DragBroken = Marshal.GetFunctionPointerForDelegate(surfaceEvents.DragBroken), Draw = Marshal.GetFunctionPointerForDelegate(surfaceEvents.Draw), KeyEvent = Marshal.GetFunctionPointerForDelegate(surfaceEvents.KeyEvent), MouseCrossed = Marshal.GetFunctionPointerForDelegate(surfaceEvents.MouseCrossed), MouseEvent = Marshal.GetFunctionPointerForDelegate(surfaceEvents.MouseEvent) }; }
/// <summary> /// Initializes a new instance of the <see cref="Separator"/> class with the specified orientation. /// </summary> /// <param name="orientation">The specified orientation.</param> public Separator(Orientation orientation) { switch (orientation) { case Orientation.Horizontal: Handle = new SafeControlHandle(LibuiLibrary.uiNewHorizontalSeparator()); break; case Orientation.Vertical: Handle = new SafeControlHandle(LibuiLibrary.uiNewVerticalSeparator()); break; default: throw new ArgumentOutOfRangeException(nameof(orientation)); } Orientation = orientation; }
/// <summary> /// Initializes a new instance of the <see cref="Window"/> class, with the options of specifying /// the window's width, height, title, and whether or not it has a <see cref="MenuStrip"/>. /// </summary> /// <param name="width">The width of the window.</param> /// <param name="height">The height of the window.</param> /// <param name="title">The title at the top of the window.</param> /// <param name="hasMenuStrip">Whether or not the window will have a menu.</param> public Window(int width = 500, int height = 300, string title = null, bool hasMenuStrip = false) : base() { if (string.IsNullOrEmpty(title)) { title = "LibUISharp"; } IntPtr strPtr = title.ToLibuiString(); Handle = new SafeControlHandle(LibuiLibrary.uiNewWindow(strPtr, width, height, hasMenuStrip)); Marshal.FreeHGlobal(strPtr); WindowCache.Add(Handle, this); this.title = title; size = new Size(width, height); InitializeEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="StackPanel"/> class with the specified orientation. /// </summary> /// <param name="orientation">The orientation controls are placed in the <see cref="StackPanel"/>.</param> public StackPanel(Orientation orientation) { switch (orientation) { case Orientation.Horizontal: Handle = new SafeControlHandle(LibuiLibrary.uiNewHorizontalBox()); break; case Orientation.Vertical: Handle = new SafeControlHandle(LibuiLibrary.uiNewVerticalBox()); break; default: throw new ArgumentOutOfRangeException("orientation"); } Orientation = orientation; }
/// <summary> /// Initializes a new instance of the <see cref="DateTimePickerBase"/> class. /// </summary> protected DateTimePickerBase() { if (this is DatePicker) { Handle = new SafeControlHandle(LibuiLibrary.uiNewDatePicker()); } else if (this is TimePicker) { Handle = new SafeControlHandle(LibuiLibrary.uiNewTimePicker()); } else { Handle = new SafeControlHandle(LibuiLibrary.uiNewDateTimePicker()); } #if LIBUI_4_0 InitializeEvents(); #endif }
/// <summary> /// Initializes a new instance of the <see cref="TextBoxBase"/> class. /// </summary> protected TextBoxBase() { if (!(this is TextBlock)) { if (this is PasswordBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewPasswordEntry()); } else if (this is SearchBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewSearchEntry()); } else { Handle = new SafeControlHandle(LibuiLibrary.uiNewEntry()); } } }
public TextBox() { if (!(this is MultilineTextBox)) { if (this is PasswordBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewPasswordEntry()); } else if (this is SearchBox) { Handle = new SafeControlHandle(LibuiLibrary.uiNewSearchEntry()); } else { Handle = new SafeControlHandle(LibuiLibrary.uiNewEntry()); } InitializeEvents(); } else { throw new TypeInitializationException("LibUISharp.Controls.MultilineTextBox", new InvalidOperationException()); } }
internal StackContainerBase(SafeControlHandle handle, bool cacheable = true) : base(handle, cacheable) { }
internal MenuStripItem(IntPtr handle) { Handle = new SafeControlHandle(handle); InitializeEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="DateTimePickerBase"/> class. /// </summary> internal DateTimePickerBase(SafeControlHandle handle, bool cacheable = true) : base(handle, cacheable) { }
internal SingleChildContainer(SafeControlHandle handle, bool cacheable = true) : base(handle, cacheable) { }
/// <summary> /// Initializes a new instance of the <see cref="ColorPicker"/> class. /// </summary> public ColorPicker() { Handle = new SafeControlHandle(LibuiLibrary.uiNewColorButton()); color = Color.Empty; InitializeEvents(); }
internal Context(SafeControlHandle Handle) { }
/// <summary> /// Initializes a new instance of a <see cref="PreferencesMenuItem"/> class from the specified handle. /// </summary> /// <param name="handle">The specified handle.</param> internal PreferencesMenuItem(SafeControlHandle handle) : base(handle) { }
internal TextBlockBase(SafeControlHandle handle, bool cacheable = true) : base(handle, cacheable) => InitializeEvents();
/// <summary> /// Initializes a new instance of a <see cref="QuitMenuItem"/> class from the specified handle. /// </summary> /// <param name="handle">The specified handle.</param> internal QuitMenuItem(SafeControlHandle handle) : base(handle) { }
internal SeparatorBase(SafeControlHandle handle, bool cacheable = true) : base(handle, cacheable) { }
/// <summary> /// Initializes a new instance of the <see cref="RadioButtonList"/> class. /// </summary> public RadioButtonList() { Handle = new SafeControlHandle(LibuiLibrary.uiNewRadioButtons()); InitializeEvents(); }
/// <summary> /// Initializes a new instance of a <see cref="MenuItemBase"/> class from the specified handle. /// </summary> /// <param name="handle">The specified handle.</param> internal MenuItemBase(SafeControlHandle handle) : base(handle) => InitializeEvents();
/// <summary> /// Initializes a new instance of a <see cref="MenuItem"/> class from the specified handle with the specified name. /// </summary> /// <param name="handle">The specified handle.</param> /// <param name="name">The menu child's name.</param> internal MenuItem(SafeControlHandle handle, string name) : base(handle) => Name = name;
public FontPicker() { Handle = new SafeControlHandle(LibuiLibrary.uiNewFontButton()); InitializeEvents(); }