-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Note**: This PR also contains content of previous Grid View PR. We decided to discard the previous, because this one did some refactoring of old one, and it's not a big addition. Added a scrollable::GridView component, which just embeds the GridView in ScrollArea. Also, re-worked the idea of text layers. https://user-images.githubusercontent.com/3919101/179020359-512ee127-c333-4f86-bff5-f1cb4154e03c.mp4
- Loading branch information
Showing
22 changed files
with
1,171 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ enso/ | |
|
||
# Popular IDEs | ||
.idea | ||
.bsp |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "ensogl-grid-view" | ||
version = "0.1.0" | ||
authors = ["Enso Team <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
enso-frp = { path = "../../../frp" } | ||
ensogl-core = { path = "../../core" } | ||
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" } | ||
ensogl-shadow = { path = "../shadow" } | ||
ensogl-text = { path = "../text" } | ||
ensogl-scroll-area = { path = "../scroll-area" } | ||
itertools = "0.10.3" | ||
|
||
[dev-dependencies] | ||
approx = "0.5.1" |
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,54 @@ | ||
//! A module with an [`Entry`] abstraction for [`crate::GridView`]. `GridView` can be parametrized | ||
//! by any entry with the specified API. | ||
use crate::prelude::*; | ||
|
||
use enso_frp as frp; | ||
use ensogl_core::application::Application; | ||
use ensogl_core::display; | ||
use ensogl_core::display::scene::Layer; | ||
|
||
|
||
|
||
// =========== | ||
// === FRP === | ||
// =========== | ||
|
||
ensogl_core::define_endpoints_2! { <Model: (frp::node::Data), Params: (frp::node::Data)> | ||
Input { | ||
set_model(Model), | ||
set_size(Vector2), | ||
set_params(Params), | ||
} | ||
Output {} | ||
} | ||
|
||
/// FRP Api of a specific Entry. | ||
pub type EntryFrp<E> = Frp<<E as Entry>::Model, <E as Entry>::Params>; | ||
|
||
|
||
|
||
// ============= | ||
// === Trait === | ||
// ============= | ||
|
||
/// The abstraction of Entry for [`crate::GridView`]. | ||
/// | ||
/// The entry may be any [`display::Object`] which can provide the [`EntryFRP`] API. | ||
pub trait Entry: CloneRef + Debug + display::Object + 'static { | ||
/// The model of this entry. The entry should be a representation of data from the Model. | ||
/// For example, the entry being just a caption can have [`String`] as its model - the text to | ||
/// be displayed. | ||
type Model: Clone + Debug + Default; | ||
|
||
/// A type parametrizing the various aspects of the entry, independed of the Model (for example | ||
/// the text color). The parameters are set in [`crate::GridView`] and shared between all | ||
/// entries. | ||
type Params: Clone + Debug + Default; | ||
|
||
/// An Entry constructor. | ||
fn new(app: &Application, text_layer: &Option<Layer>) -> Self; | ||
|
||
/// FRP endpoints getter. | ||
fn frp(&self) -> &EntryFrp<Self>; | ||
} |
Oops, something went wrong.