Compare commits
No commits in common. "ec173f860dff65ba396bbf377eaa94deffb644dc" and "c01680f46f85cb143f74bc2e2c7a693553b7c47b" have entirely different histories.
ec173f860d
...
c01680f46f
37
src/main.rs
37
src/main.rs
@ -1,38 +1,25 @@
|
||||
use cacao::appkit::window::{TitleVisibility, Window, WindowConfig, WindowController};
|
||||
use cacao::appkit::{App, AppDelegate};
|
||||
use cacao::button::Button;
|
||||
use cacao::view::{SplitViewController, View, ViewDelegate};
|
||||
|
||||
use crate::view::details_view::Details;
|
||||
use crate::view::sidebar::MainSidebar;
|
||||
use crate::view::content_view::ScreenView;
|
||||
use crate::window::main_window::MainWindow;
|
||||
use cacao::appkit::window::Window;
|
||||
use cacao::color::Color;
|
||||
|
||||
mod disk_util;
|
||||
mod ipod_util;
|
||||
|
||||
mod view;
|
||||
mod window;
|
||||
|
||||
const VENDOR_ID: u16 = 1452;
|
||||
const PRODUCT_ID: u16 = 4617;
|
||||
|
||||
struct ILoaderApp {
|
||||
window: WindowController<MainWindow>
|
||||
#[derive(Default)]
|
||||
struct BasicApp {
|
||||
window: Window
|
||||
}
|
||||
|
||||
impl AppDelegate for ILoaderApp {
|
||||
/// There should be stuff which loads underlying logic for communication with IPod
|
||||
fn will_finish_launching(&self) {}
|
||||
|
||||
impl AppDelegate for BasicApp {
|
||||
fn did_finish_launching(&self) {
|
||||
App::activate();
|
||||
self.window.set_minimum_content_size(400., 400.);
|
||||
self.window.set_title("Hello World!");
|
||||
self.window.set_background_color(Color::rgb(255, 0,0));
|
||||
self.window.show();
|
||||
}
|
||||
|
||||
fn should_terminate_after_last_window_closed(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -43,9 +30,5 @@ fn main() {
|
||||
println!("{}", ipod_util::get_ipod_path().is_some());
|
||||
}
|
||||
}*/
|
||||
let config = WindowConfig::default();
|
||||
|
||||
App::new("com.alterdekim.iloader", ILoaderApp {
|
||||
window: WindowController::with(config, MainWindow::default())
|
||||
}).run();
|
||||
App::new("com.hello.world", BasicApp::default()).run();
|
||||
}
|
||||
|
53
src/view.rs
53
src/view.rs
@ -1,53 +0,0 @@
|
||||
|
||||
pub mod sidebar {
|
||||
use cacao::view::{View, ViewDelegate};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MainSidebar {
|
||||
|
||||
}
|
||||
|
||||
impl ViewDelegate for MainSidebar {
|
||||
const NAME: &'static str = "MainSidebar";
|
||||
|
||||
fn did_load(&mut self, _view: View) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod content_view {
|
||||
use cacao::{button::Button, layout::Layout, view::{View, ViewDelegate}};
|
||||
|
||||
pub struct ScreenView {
|
||||
pub btn: Button
|
||||
}
|
||||
|
||||
impl Default for ScreenView {
|
||||
fn default() -> Self {
|
||||
let btn = Button::new("test");
|
||||
Self { btn }
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewDelegate for ScreenView {
|
||||
const NAME: &'static str = "ScreenView";
|
||||
|
||||
fn did_load(&mut self, view: View) {
|
||||
view.add_subview(&self.btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod details_view {
|
||||
use cacao::{button::Button, layout::Layout, view::{View, ViewDelegate}};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Details {
|
||||
|
||||
}
|
||||
|
||||
impl ViewDelegate for Details {
|
||||
const NAME: &'static str = "Details";
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
pub mod main_window {
|
||||
use cacao::{appkit::window::{TitleVisibility, Window, WindowDelegate}, view::SplitViewController};
|
||||
|
||||
use crate::view::{content_view::ScreenView, details_view::Details, sidebar::MainSidebar};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MainWindow {
|
||||
split_view_controller: Option<SplitViewController<MainSidebar, ScreenView, Details>>
|
||||
}
|
||||
|
||||
impl WindowDelegate for MainWindow {
|
||||
const NAME: &'static str = "MainWindow";
|
||||
|
||||
fn did_load(&mut self, window: Window) {
|
||||
window.set_title("ILoader");
|
||||
window.set_title_visibility(TitleVisibility::Hidden);
|
||||
window.set_titlebar_appears_transparent(true);
|
||||
window.set_movable_by_background(true);
|
||||
window.set_autosave_name("CacaoILoader");
|
||||
window.set_minimum_content_size(980., 700.);
|
||||
|
||||
let split_view_controller = SplitViewController::new(MainSidebar::default(),
|
||||
ScreenView::default(),
|
||||
Some(Details::default())); // Some(DetailView::default())
|
||||
|
||||
window.set_content_view_controller(&split_view_controller);
|
||||
|
||||
self.split_view_controller = Some(split_view_controller);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user