added submodule for custom python interpreter
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use hashbrown::HashMap;
|
||||
use spin::{Mutex};
|
||||
use crate::std::frame::{Frame, RenderError};
|
||||
use crate::std::render::{Frame, RenderError};
|
||||
|
||||
use alloc::{
|
||||
boxed::Box,
|
||||
|
||||
@@ -4,21 +4,21 @@ use alloc::boxed::Box;
|
||||
use core::any::Any;
|
||||
use async_trait::async_trait;
|
||||
use crate::std::application::Exit;
|
||||
use crate::std::frame::{ColouredChar, Dimensions, Frame, Position, RenderError};
|
||||
use crate::std::render::{ColouredChar, Dimensions, Frame, Position, RenderError};
|
||||
use crate::std::io::{KeyStroke, Stdin};
|
||||
use crate::user::lib::libgui::cg_core::{CgComponent, CgTextEdit, CgTextInput, Widget};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgLineEdit {
|
||||
pub position: Position,
|
||||
pub dimensions: Dimensions,
|
||||
pub position: Position<usize>,
|
||||
pub dimensions: Dimensions<usize>,
|
||||
pub prompt: String,
|
||||
pub text: Vec<char>,
|
||||
pub ptr: usize, // cursor position
|
||||
}
|
||||
|
||||
impl CgLineEdit {
|
||||
pub fn new(position: Position, width: usize, prompt: String) -> CgLineEdit {
|
||||
pub fn new(position: Position<usize>, width: usize, prompt: String) -> CgLineEdit {
|
||||
CgLineEdit {
|
||||
position,
|
||||
dimensions: Dimensions::new(width, 1),
|
||||
@@ -131,15 +131,15 @@ impl CgTextInput for CgLineEdit {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgBoxEdit {
|
||||
pub position: Position,
|
||||
pub dimensions: Dimensions,
|
||||
pub position: Position<usize>,
|
||||
pub dimensions: Dimensions<usize>,
|
||||
pub prompt: String,
|
||||
pub text: Vec<char>,
|
||||
pub ptr: Position,
|
||||
pub ptr: Position<usize>,
|
||||
}
|
||||
|
||||
impl CgBoxEdit {
|
||||
pub fn new(position: Position, dimensions: Dimensions, prompt: String) -> CgBoxEdit {
|
||||
pub fn new(position: Position<usize>, dimensions: Dimensions<usize>, prompt: String) -> CgBoxEdit {
|
||||
CgBoxEdit {
|
||||
position,
|
||||
dimensions,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::std::frame::{ColouredChar, Dimensions, Frame, Position, RenderError};
|
||||
use crate::std::render::{ColouredChar, Dimensions, Frame, Position, RenderError};
|
||||
|
||||
pub(crate) fn render_outline(frame: &mut Frame, dimensions: Dimensions) -> Result<(), RenderError> {
|
||||
pub(crate) fn render_outline(frame: &mut Frame, dimensions: Dimensions<usize>) -> Result<(), RenderError> {
|
||||
// draws the sides of the container
|
||||
for i in 0..frame.dimensions.x {
|
||||
frame.write(Position::new(i, 0), ColouredChar::new('─'))?;
|
||||
|
||||
@@ -7,19 +7,19 @@ use hashbrown::HashMap;
|
||||
use crate::std::application::Exit;
|
||||
use super::cg_core::{CgComponent, CgKeyboardCapture, Widget};
|
||||
use super::cg_utils::render_outline;
|
||||
use crate::std::frame::{ColouredChar, Dimensions, Position, Frame, RenderError, ColorCode, BUFFER_WIDTH, BUFFER_HEIGHT};
|
||||
use crate::std::render::{ColouredChar, Dimensions, Position, Frame, RenderError, ColorCode, BUFFER_WIDTH, BUFFER_HEIGHT};
|
||||
use crate::std::io::{Color, KeyStroke, Stdin};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgContainer {
|
||||
pub elements: HashMap<&'static str, Widget>,
|
||||
pub position: Position,
|
||||
pub dimensions: Dimensions,
|
||||
pub position: Position<usize>,
|
||||
pub dimensions: Dimensions<usize>,
|
||||
pub outlined: bool,
|
||||
}
|
||||
|
||||
impl CgContainer {
|
||||
pub fn new(position: Position, dimensions: Dimensions, outlined: bool) -> CgContainer {
|
||||
pub fn new(position: Position<usize>, dimensions: Dimensions<usize>, outlined: bool) -> CgContainer {
|
||||
CgContainer {
|
||||
elements: HashMap::new(),
|
||||
position,
|
||||
@@ -60,14 +60,14 @@ impl CgComponent for CgContainer {
|
||||
pub struct CgTextBox {
|
||||
title: String,
|
||||
pub content: String,
|
||||
pub position: Position,
|
||||
pub dimensions: Dimensions,
|
||||
pub position: Position<usize>,
|
||||
pub dimensions: Dimensions<usize>,
|
||||
outlined: bool,
|
||||
wrap_words: bool // if false then will not wrap until the end of a word if possible
|
||||
}
|
||||
|
||||
impl CgTextBox {
|
||||
pub fn new(title: String, content: String, position: Position, dimensions: Dimensions, outlined: bool) -> CgTextBox {
|
||||
pub fn new(title: String, content: String, position: Position<usize>, dimensions: Dimensions<usize>, outlined: bool) -> CgTextBox {
|
||||
CgTextBox { title, content, position, dimensions, outlined, wrap_words: true }
|
||||
}
|
||||
|
||||
@@ -143,13 +143,13 @@ impl CgComponent for CgTextBox {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgLabel {
|
||||
content: String,
|
||||
position: Position,
|
||||
dimensions: Dimensions,
|
||||
position: Position<usize>,
|
||||
dimensions: Dimensions<usize>,
|
||||
centered: bool,
|
||||
}
|
||||
|
||||
impl CgLabel {
|
||||
pub fn new(content: String, position: Position, width: usize, centered: bool) -> CgLabel {
|
||||
pub fn new(content: String, position: Position<usize>, width: usize, centered: bool) -> CgLabel {
|
||||
CgLabel {
|
||||
content,
|
||||
position: Position::new(position.x, position.y),
|
||||
@@ -247,12 +247,12 @@ impl CgComponent for CgIndicatorWidget {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgIndicatorBar {
|
||||
pub fields: Vec<CgIndicatorWidget>,
|
||||
position: Position,
|
||||
dimensions: Dimensions,
|
||||
position: Position<usize>,
|
||||
dimensions: Dimensions<usize>,
|
||||
}
|
||||
|
||||
impl CgIndicatorBar {
|
||||
pub fn new(position: Position, width: usize) -> CgIndicatorBar {
|
||||
pub fn new(position: Position<usize>, width: usize) -> CgIndicatorBar {
|
||||
CgIndicatorBar {
|
||||
fields: Vec::new(),
|
||||
position: Position::new(position.x, position.y),
|
||||
@@ -291,8 +291,8 @@ impl CgComponent for CgIndicatorBar {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CgStatusBar {
|
||||
position: Position,
|
||||
dimensions: Dimensions,
|
||||
position: Position<usize>,
|
||||
dimensions: Dimensions<usize>,
|
||||
|
||||
window_title: CgIndicatorWidget,
|
||||
screen_mode: CgIndicatorWidget,
|
||||
@@ -325,7 +325,7 @@ impl CgComponent for CgStatusBar {
|
||||
}
|
||||
|
||||
impl CgStatusBar {
|
||||
pub fn new(position: Position, dimensions: Dimensions) -> CgStatusBar {
|
||||
pub fn new(position: Position<usize>, dimensions: Dimensions<usize>) -> CgStatusBar {
|
||||
let mut widget = CgStatusBar {
|
||||
position,
|
||||
dimensions,
|
||||
|
||||
Reference in New Issue
Block a user