-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95036b1
commit 5009baa
Showing
10 changed files
with
282 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* PROJECT: Aura Operating System Development | ||
* CONTENT: Label class | ||
* PROGRAMMERS: Valentin Charbonnier <[email protected]> | ||
*/ | ||
|
||
using Cosmos.System.Graphics.Fonts; | ||
using System; | ||
using System.Drawing; | ||
|
||
namespace Aura_OS.System.Graphics.UI.GUI.Components | ||
{ | ||
public class Checkbox : Component | ||
{ | ||
public Color TextColor; | ||
public string Text = ""; | ||
public bool Checked = false; | ||
|
||
private Button _check; | ||
|
||
public Checkbox(string text, Color color, int x, int y) : base(x, y, (text.Length * Kernel.font.Width) + 13 + 6, 13) | ||
{ | ||
_check = new Button((text.Length * Kernel.font.Width) + 3, 0, 13, 13); | ||
_check.SetNormalFrame(Kernel.ThemeManager.GetFrame("check.off.normal")); | ||
_check.SetHighlightedFrame(Kernel.ThemeManager.GetFrame("check.off.highlighted")); | ||
_check.Click = new Action(() => | ||
{ | ||
Checked = !Checked; | ||
|
||
if (Checked) | ||
{ | ||
_check.SetNormalFrame(Kernel.ThemeManager.GetFrame("check.on.normal")); | ||
_check.SetHighlightedFrame(Kernel.ThemeManager.GetFrame("check.on.highlighted")); | ||
_check.Draw(this); | ||
MarkDirty(); | ||
} | ||
else | ||
{ | ||
_check.SetNormalFrame(Kernel.ThemeManager.GetFrame("check.off.normal")); | ||
_check.SetHighlightedFrame(Kernel.ThemeManager.GetFrame("check.off.highlighted")); | ||
_check.Draw(this); | ||
MarkDirty(); | ||
} | ||
}); | ||
|
||
AddChild(_check); | ||
|
||
TextColor = color; | ||
Text = text; | ||
} | ||
|
||
public override void Update() | ||
{ | ||
_check.Update(); | ||
} | ||
|
||
public override void Draw() | ||
{ | ||
Clear(Color.Transparent); | ||
|
||
_check.Draw(this); | ||
|
||
if (Text != "") | ||
{ | ||
DrawString(Text, Kernel.font, TextColor, 0, 0); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* PROJECT: Aura Operating System Development | ||
* CONTENT: Label class | ||
* PROGRAMMERS: Valentin Charbonnier <[email protected]> | ||
*/ | ||
|
||
using Cosmos.System.Graphics.Fonts; | ||
using System.Drawing; | ||
|
||
namespace Aura_OS.System.Graphics.UI.GUI.Components | ||
{ | ||
public class Label : Component | ||
{ | ||
public Color TextColor; | ||
public string Text = ""; | ||
|
||
public Label(string text, Color color, int x, int y) : base(x, y, text.Length * Kernel.font.Width, Kernel.font.Height) | ||
{ | ||
TextColor = color; | ||
Text = text; | ||
} | ||
|
||
public override void Draw() | ||
{ | ||
Clear(Color.Transparent); | ||
|
||
if (Text != "") | ||
{ | ||
DrawString(Text, Kernel.font, TextColor, 0, 0); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.