forked from AbleOS/ableos_userland
adding in cursor support to agl
This commit is contained in:
parent
441cb4cf81
commit
10e955cdfe
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
|
|
||||||
use able_graphics_library::display::parse_display_string;
|
use able_graphics_library::engine3d::display::parse_display_string;
|
||||||
|
|
||||||
const VGA_ADDRESS: *mut u8 = 0xB8000 as *mut u8;
|
const VGA_ADDRESS: *mut u8 = 0xB8000 as *mut u8;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ fn start() {
|
||||||
// (e.g. 640x480, 800x600, etc.).
|
// (e.g. 640x480, 800x600, etc.).
|
||||||
|
|
||||||
let result = parse_display_string("680x480x16@60");
|
let result = parse_display_string("680x480x16@60");
|
||||||
use able_graphics_library::display::DisplayError::*;
|
use able_graphics_library::engine3d::display::DisplayError::*;
|
||||||
match result {
|
match result {
|
||||||
Ok(display) => {
|
Ok(display) => {
|
||||||
let (width, height, bpp, fps) = display;
|
let (width, height, bpp, fps) = display;
|
||||||
|
|
58
libraries/able_graphics_library/src/cursor.rs
Normal file
58
libraries/able_graphics_library/src/cursor.rs
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
pub enum CursorStates {
|
||||||
|
// Default cursor. Indicates the interface is idle and prepared to accept commands from the user. Used to manipulate basic user interface elements like buttons and scrollbars. Usually a left pointing diagonal arrow.
|
||||||
|
Default,
|
||||||
|
// Text input cursor. Indicates that the cursor is in a region in which horizontal text can be selected and possibly edited. Typically rendered as a vertical I-beam.
|
||||||
|
Text,
|
||||||
|
// Indicates that the object below the cursor is clickable. This cursor is typically used for links in web browsers. It shouldn't be abused for pushbuttons and other UI elements where it's otherwise apparent by the design of the widget that it's a clickable object. Often rendered as a pointing hand.
|
||||||
|
Pointer,
|
||||||
|
// Help cursor. Indicates that the system is in a context help mode, and if the user clicks an object a small window will open up to provide usage information for that object. The context help mode is typically activated by clicking a help button on the titlebar of a window that provides context help. Often rendered as the default cursor with a question mark symbol next to it.
|
||||||
|
Help,
|
||||||
|
// Default cursor + busy cursor. Indicates a pending activity which may asynchronously affect the interface but which is not blocking commands from the user.
|
||||||
|
Progress,
|
||||||
|
// Busy cursor. Indicates that the interface is not prepared to accept commands from the user and is blocked on some external resource. Often rendered as a watch or an hourglass.
|
||||||
|
Wait,
|
||||||
|
// !DnD copy cursor. Indicates that a copy of the dragged object will be created in the area below the cursor if dropped. Typically rendered as the default cursor with a small plus sign next to it.
|
||||||
|
Copy,
|
||||||
|
// !DnD link cursor. Indicates that a link to the original location of the dragged object will be created in the area below the cursor if dropped. Typically rendered as the default cursor with a small curved arrow next to it.
|
||||||
|
Alias,
|
||||||
|
// Indicates that a context menu is available for the object underneath the cursor. Typically rendered as the default cursor with a small menu-like graphic next to it.
|
||||||
|
ContextMenu,
|
||||||
|
// !DnD no-drop cursor. Indicates that the dragged object can't be dropped in the region below the cursor. Typically rendered as the default cursor with a small circle with a diagonal line through it. Can be identical to not-allowed.
|
||||||
|
NoDrop,
|
||||||
|
// Forbidden cursor. Indicates that a particular region is invalid for the current operation. Often rendered as circle with a diagonal line through it.
|
||||||
|
NotAllowed,
|
||||||
|
// Scroll/move cursor. Used to indicate that moving the mouse will also move the UI element below the cursor. Often rendered as a combined vertical and horizontal twin-headed arrow.
|
||||||
|
AllScroll,
|
||||||
|
// Horizontal splitter bar cursor. Indicates that the bar below the cursor can be moved up and down to resize the objects it separates. Used when it's not apparent if the object below the cursor is just a visual separator between two other UI elements, or an object that can be manipulated. Usually rendered as a vertical twin-headed arrow, split in the middle by a horizontal line.
|
||||||
|
RowResize,
|
||||||
|
// Vertical splitter bar cursor. Indicates that the bar below the cursor can be moved left and right to resize the objects it separates. Used when it's not apparent if the object below the cursor is just a visual separator between two other UI elements, or an object that can be manipulated. Usually rendered as a horizonal twin-headed arrow, split in the middle by a vertical line.
|
||||||
|
ColResize,
|
||||||
|
// Indicates that the cursor is over the right edge of a window, and that the edge can be clicked and dragged in order to resize the window horizontally.
|
||||||
|
RightResize,
|
||||||
|
// Indicates that the cursor is over the top-right edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.
|
||||||
|
TopRightResize,
|
||||||
|
// Indicates that the cursor is over the top-left edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.
|
||||||
|
TopLeftResize,
|
||||||
|
// Indicates that the cursor is over the top edge of a window, and that the edge can be clicked and dragged in order to resize the window vertically.
|
||||||
|
TopResize,
|
||||||
|
// Indicates that the cursor is over the bottom-right edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.
|
||||||
|
BottomRightResize,
|
||||||
|
// Indicates that the cursor is over the bottom-left edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.
|
||||||
|
BottomLeftResize,
|
||||||
|
// Indicates that the cursor is over the bottom edge of a window, and that the edge can be clicked and dragged in order to resize the window vertically.
|
||||||
|
BottomResize,
|
||||||
|
// Indicates that the cursor is over the left edge of a window, and that the edge can be clicked and dragged in order to resize the window horizontally.
|
||||||
|
LeftResize,
|
||||||
|
// Horizontal resizing cursor. Indicates that cursor is over the the left or right edge of a window, and that ithe edge can be clicked and dragged to resize the window horizontally. Typically rendered as a horizontal twin-headed arrow.
|
||||||
|
LeftRightResize,
|
||||||
|
// Vertical resizing cursor. Indicates that cursor is over the the top or bottom edge of a window, and that the edge can be clicked and dragged to resize the window vertically. Typically rendered as a verticaly twin-headed arrow.
|
||||||
|
TopBottomResize,
|
||||||
|
// Back-diagonal resizing cursor. Indicates that the UI element below the cursor is the top-right or bottom-left corner of a window, and that it can be clicked and dragged to resize the window diagonally. Typically a twin-headed arrow.
|
||||||
|
BackwardDiagonalResize,
|
||||||
|
// Forward-diagonal resizing cursor. Indicates that the UI element below the cursor is the top-left or bottom-right corner of a window, and that it can be clicked and dragged to resize the window diagonally. Typically a twin-headed arrow.
|
||||||
|
ForwardDiagonalResize,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Cursor {
|
||||||
|
pub cursor_state: CursorStates,
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
use cursor::{Cursor, CursorStates};
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
pub mod color;
|
pub mod color;
|
||||||
|
pub mod cursor;
|
||||||
pub mod engine3d;
|
pub mod engine3d;
|
||||||
pub mod ptmode;
|
pub mod ptmode;
|
||||||
|
|
||||||
|
@ -26,10 +29,15 @@ pub enum GraphicsMode {
|
||||||
|
|
||||||
pub struct GraphicsSettings {
|
pub struct GraphicsSettings {
|
||||||
mode: GraphicsMode,
|
mode: GraphicsMode,
|
||||||
|
cursor: Cursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GraphicsSettings {
|
impl GraphicsSettings {
|
||||||
pub fn get_mode(&self) -> GraphicsMode {
|
pub fn get_mode(&self) -> GraphicsMode {
|
||||||
self.mode
|
self.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_cursor_state(&mut self, c_state: CursorStates) {
|
||||||
|
self.cursor.cursor_state = c_state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue