input: impl Selectable for TextInput that allow it as tigger for popover (#1353)
This commit is contained in:
parent
bfe99a2d33
commit
20ddb88e95
1 changed files with 14 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ use crate::indicator::Indicator;
|
||||||
use crate::input::clear_button;
|
use crate::input::clear_button;
|
||||||
use crate::input::element::{LINE_NUMBER_RIGHT_MARGIN, RIGHT_MARGIN};
|
use crate::input::element::{LINE_NUMBER_RIGHT_MARGIN, RIGHT_MARGIN};
|
||||||
use crate::scroll::Scrollbar;
|
use crate::scroll::Scrollbar;
|
||||||
use crate::{h_flex, StyledExt};
|
use crate::{h_flex, Selectable, StyledExt};
|
||||||
use crate::{v_flex, ActiveTheme};
|
use crate::{v_flex, ActiveTheme};
|
||||||
use crate::{IconName, Size};
|
use crate::{IconName, Size};
|
||||||
use crate::{Sizable, StyleSized};
|
use crate::{Sizable, StyleSized};
|
||||||
|
|
@ -32,6 +32,7 @@ pub struct TextInput {
|
||||||
bordered: bool,
|
bordered: bool,
|
||||||
focus_bordered: bool,
|
focus_bordered: bool,
|
||||||
tab_index: isize,
|
tab_index: isize,
|
||||||
|
selected: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sizable for TextInput {
|
impl Sizable for TextInput {
|
||||||
|
|
@ -41,6 +42,17 @@ impl Sizable for TextInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Selectable for TextInput {
|
||||||
|
fn selected(mut self, selected: bool) -> Self {
|
||||||
|
self.selected = selected;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_selected(&self) -> bool {
|
||||||
|
self.selected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TextInput {
|
impl TextInput {
|
||||||
/// Create a new [`TextInput`] element bind to the [`InputState`].
|
/// Create a new [`TextInput`] element bind to the [`InputState`].
|
||||||
pub fn new(state: &Entity<InputState>) -> Self {
|
pub fn new(state: &Entity<InputState>) -> Self {
|
||||||
|
|
@ -58,6 +70,7 @@ impl TextInput {
|
||||||
bordered: true,
|
bordered: true,
|
||||||
focus_bordered: true,
|
focus_bordered: true,
|
||||||
tab_index: 0,
|
tab_index: 0,
|
||||||
|
selected: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue