Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Egui text input #312

Merged
merged 6 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rust/src/shards/gui/containers/panels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ macro_rules! impl_panel {
Some(&self.requiring)
}

fn hasCompose() -> bool {
true
}

fn compose(&mut self, data: &InstanceData) -> Result<Type, &str> {
// we need to inject UI variable to the inner shards
let mut data = *data;
Expand Down Expand Up @@ -292,6 +296,10 @@ impl Shard for CentralPanel {
Some(&self.requiring)
}

fn hasCompose() -> bool {
true
}

fn compose(&mut self, data: &InstanceData) -> Result<Type, &str> {
// we need to inject UI variable to the inner shards
let mut data = *data;
Expand Down
4 changes: 4 additions & 0 deletions rust/src/shards/gui/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ impl Shard for Window {
Some(&self.requiring)
}

fn hasCompose() -> bool {
true
}

fn compose(&mut self, data: &InstanceData) -> Result<Type, &str> {
// we need to inject UI variable to the inner shards
let mut data = *data;
Expand Down
4 changes: 4 additions & 0 deletions rust/src/shards/gui/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ impl Shard for EguiContext {
Some(&self.requiring)
}

fn hasCompose() -> bool {
true
}

fn compose(&mut self, data: &InstanceData) -> Result<Type, &str> {
// we need to inject the UI context to the inner shards
let mut data = *data;
Expand Down
1 change: 1 addition & 0 deletions rust/src/shards/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use egui::Context as EguiNativeContext;
use std::ffi::c_void;

static BOOL_OR_NONE_SLICE: &[Type] = &[common_type::bool, common_type::none];
static STRING_VAR_SLICE: &[Type] = &[common_type::string, common_type::string_var];

static EGUI_UI_TYPE: Type = Type::object(FRAG_CC, 1701279061); // 'eguU'
static EGUI_UI_SLICE: &'static [Type] = &[EGUI_UI_TYPE];
Expand Down
4 changes: 4 additions & 0 deletions rust/src/shards/gui/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ impl Shard for Button {
Some(&self.requiring)
}

fn hasCompose() -> bool {
true
}

fn compose(&mut self, data: &InstanceData) -> Result<Type, &str> {
if !self.action.is_empty() {
self.action.compose(&data)?;
Expand Down
12 changes: 12 additions & 0 deletions rust/src/shards/gui/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,22 @@ struct Label {
wrap: ParamVar,
}

struct TextInput {
parents: ParamVar,
requiring: ExposedTypes,
variable: ParamVar,
multiline: ParamVar,
exposing: ExposedTypes,
should_expose: bool,
mutable_text: bool,
}

mod button;
mod label;
mod text_input;

pub fn registerShards() {
registerShard::<Button>();
registerShard::<Label>();
registerShard::<TextInput>();
}
Loading