page layout tool
git clone https://git.lucas.co/cce-layout-interface.git
Remove Paginator widget and tab margin spinboxes
src/main.rs | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index da1483a..fd00ed2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,8 +4,8 @@ use serde::{Serialize, Deserialize};
use cce_ui::engine::{Application, EngineState, LogicalPosition, LogicalSize, WindowSettings, LineCap};
use cce_ui::widget::{
MouseButton, ElementState, MouseScrollDelta, KeyEvent, TextItem, Element as UiElement,
- TextBox, Slider, TextLabel, Paginator, Button, Dropdown, Toggle, ColorSelector,
- Label, Spinbox, Key, NamedKey, ScrollingList, FontSelector
+ TextBox, Slider, TextLabel, MenuBar, Button, Dropdown, Toggle, ColorSelector,
+ Label, Spinbox, Key, NamedKey, ScrollingList, FontSelector, PageSelector, MenuController
};
use cce_ui::layout::{RenderTarget, Section, UiFrame};
@@ -278,7 +278,7 @@ struct LayoutApp {
btn_exit: Button,
btn_save: Button,
btn_save_as: Button,
- paginator: Paginator,
+ paginator: MenuBar,
layer_buttons: Vec<Box<Button>>,
elements: Vec<Element>,
selected_idx: Option<usize>,
@@ -2528,18 +2528,17 @@ impl Application for LayoutApp {
let btn_save_as = Button::new(0.0, 0.0, 240.0, 26.0).with_label("Save As");
let btn_exit = Button::new(0.0, 0.0, 240.0, 26.0).with_label("Exit Application");
- // Build the sidebar Paginator
- let paginator = Paginator::new(56.0, vec![
+ let mut paginator = MenuBar::new(0.0, 0.0, 56.0, 0.0)
+ .with_vertical(true)
+ .with_title("LAYOUT");
+ paginator.set_pages(vec![
"File".to_string(),
"Page".to_string(),
"Element".to_string(),
"Canvas".to_string(),
"Guides".to_string(),
"Layers".to_string(),
- ])
- .with_tabs_at_top(false)
- .with_tabs_rotated(true)
- .with_sidebar_label("LAYOUT");
+ ]);
// Default paper sheet sizing (Letter)
let page_w = 510.0;
@@ -3562,13 +3561,10 @@ impl Application for LayoutApp {
let sidebar_w = 280.0;
if px < sidebar_w {
- let old_page = self.paginator.selected_page();
let pag_mouse = self.paginator.mouse_input(button, state, px, py, &mut self.ui_context);
if pag_mouse {
changed = true;
- if self.paginator.take_click() {
- let new_page = self.paginator.selected_page();
- self.paginator.set_selected_page(old_page);
+ if let Some((new_page, _)) = self.paginator.menu_click() {
self.active_page_widgets_unfocus();
self.apply_sidebar_changes();
self.paginator.set_selected_page(new_page);