Class CharacterPicker
Displays the glyphs associated with a font and allows the user to select one.
Implements
Inherited Members
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.Extended.dll
Syntax
public class CharacterPicker : SurfaceViewer, IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable
Constructors
CharacterPicker(Color, Color, Color, IFont, int, int, int)
Creates a new character picker control.
Declaration
public CharacterPicker(Color foreground, Color fill, Color selectedCharacterColor, IFont characterFont, int visibleColumns, int visibleRows, int fontColumns)
Parameters
Type | Name | Description |
---|---|---|
Color | foreground | Foreground color of all the glyphs. |
Color | fill | Background color of all the glyphs. |
Color | selectedCharacterColor | The foreground color displayed on the selected glyph. |
IFont | characterFont | The font used to display the glyphs. |
int | visibleColumns | The number of columns to show. The control will be this wide plus 1. |
int | visibleRows | The number of rows to show. The control will be this high plus 1. |
int | fontColumns | How many columns are defined in the font file. |
CharacterPicker(Color, Color, Color, SadFont, int, int)
Creates a new picker control with the specified font.
Declaration
public CharacterPicker(Color foreground, Color fill, Color selectedCharacterColor, SadFont characterFont, int visibleColumns, int visibleRows)
Parameters
Type | Name | Description |
---|---|---|
Color | foreground | Foreground color of all the glyphs. |
Color | fill | Background color of all the glyphs. |
Color | selectedCharacterColor | The foreground color displayed on the selected glyph. |
SadFont | characterFont | The font used to display the glyphs. |
int | visibleColumns | The number of columns to show. The control will be this wide plus 1. |
int | visibleRows | The number of rows to show. The control will be this high plus 1. |
Properties
GlyphBackground
Gets the background color used when drawing the glyphs.
Declaration
public Color GlyphBackground { get; }
Property Value
Type | Description |
---|---|
Color |
GlyphForeground
Gets the foreground color used when drawing the glyphs.
Declaration
public Color GlyphForeground { get; }
Property Value
Type | Description |
---|---|
Color |
HighlightSelectedCharacter
When true, highlights the selected character with SelectedGlyphForeground when HighlightSelectedCharacterWithEffect is false;
Declaration
public bool HighlightSelectedCharacter { get; set; }
Property Value
Type | Description |
---|---|
bool |
HighlightSelectedCharacterWithEffect
When true, uses SelectedGlyphEffect to highlight the character.
Declaration
public bool HighlightSelectedCharacterWithEffect { get; set; }
Property Value
Type | Description |
---|---|
bool |
MirrorSetting
Gets or sets the mirror effect to apply in the theme.
Declaration
public Mirror MirrorSetting { get; set; }
Property Value
Type | Description |
---|---|
Mirror |
NewCharacterLocation
Gets the position of the newly selected character. Used by the theme.
Declaration
public Point NewCharacterLocation { get; }
Property Value
Type | Description |
---|---|
Point |
OldCharacterLocation
Gets the position of the previously selected character. Used by the theme.
Declaration
public Point OldCharacterLocation { get; }
Property Value
Type | Description |
---|---|
Point |
SelectedCharacter
Gets or sets the selected glyph character.
Declaration
public int SelectedCharacter { get; set; }
Property Value
Type | Description |
---|---|
int |
SelectedGlyphEffect
Gets the effect to apply when drawing the selected glyph.
Declaration
public ICellEffect? SelectedGlyphEffect { get; set; }
Property Value
Type | Description |
---|---|
ICellEffect |
SelectedGlyphForeground
Gets the foreground color used when drawing the selected glyph.
Declaration
public Color SelectedGlyphForeground { get; }
Property Value
Type | Description |
---|---|
Color |
UseFullClick
When true, indicates that the control should use a mouse click to select a new character; otherwise false to indicate that just having the mouse down will select a new character.
Declaration
public bool UseFullClick { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
CreateControlSurface()
Generates the surface to be used by this control. This method is called internally to assign the Surface property a value.
Declaration
protected override ICellSurface CreateControlSurface()
Returns
Type | Description |
---|---|
ICellSurface | A surface that should be assigned to the Surface property. |
Overrides
OnLeftMouseClicked(ControlMouseState)
Called when the left mouse button is clicked. Raises the MouseButtonClicked event and calls the DetermineState() method.
Declaration
protected override void OnLeftMouseClicked(ControlBase.ControlMouseState info)
Parameters
Type | Name | Description |
---|---|---|
ControlBase.ControlMouseState | info |
Overrides
OnMouseIn(ControlMouseState)
Called as the mouse moves around the control area. Raises the MouseMove event and calls the DetermineState() method.
Declaration
protected override void OnMouseIn(ControlBase.ControlMouseState info)
Parameters
Type | Name | Description |
---|---|---|
ControlBase.ControlMouseState | info |
Overrides
ProcessMouse(MouseScreenObjectState)
Processes the mouse on each control hosted by this control.
Declaration
public override bool ProcessMouse(MouseScreenObjectState state)
Parameters
Type | Name | Description |
---|---|---|
MouseScreenObjectState | state | The mouse state based on the parent screen object. |
Returns
Overrides
UpdateAndRedraw(TimeSpan)
Updates each control hosted by this control.
Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | time | The game frame time delta. |
Overrides
Events
SelectedCharacterChanged
Raised when the SelectedCharacter property changes.
Declaration
public event EventHandler<ValueChangedEventArgs<int>>? SelectedCharacterChanged
Event Type
Type | Description |
---|---|
EventHandler<ValueChangedEventArgs<int>> |