new file: src/content_view.rs
modified: src/main.rs
This commit is contained in:
parent
c01680f46f
commit
d1227388bc
23
src/content_view.rs
Normal file
23
src/content_view.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use cacao::{appkit::toolbar::Toolbar, button::Button, layout::Layout, view::{View, ViewDelegate}};
|
||||
|
||||
pub struct ScreenView {
|
||||
//pub toolbar: Toolbar
|
||||
pub btn: Button
|
||||
}
|
||||
|
||||
impl ScreenView {
|
||||
pub fn new() -> Self {
|
||||
//let toolbar = Toolbar::new("toolbar", delegate);
|
||||
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);
|
||||
}
|
||||
}
|
40
src/main.rs
40
src/main.rs
@ -1,25 +1,42 @@
|
||||
use cacao::appkit::window::{TitleVisibility, Window, WindowConfig};
|
||||
use cacao::appkit::{App, AppDelegate};
|
||||
use cacao::appkit::window::Window;
|
||||
use cacao::color::Color;
|
||||
use cacao::view::View;
|
||||
|
||||
use content_view::ScreenView;
|
||||
|
||||
mod disk_util;
|
||||
mod ipod_util;
|
||||
|
||||
mod content_view;
|
||||
|
||||
const VENDOR_ID: u16 = 1452;
|
||||
const PRODUCT_ID: u16 = 4617;
|
||||
|
||||
#[derive(Default)]
|
||||
struct BasicApp {
|
||||
window: Window
|
||||
struct ILoaderApp {
|
||||
window: Window,
|
||||
content: View<ScreenView>
|
||||
}
|
||||
|
||||
impl AppDelegate for BasicApp {
|
||||
impl AppDelegate for ILoaderApp {
|
||||
/// There should be stuff which loads underlying logic for communication with IPod
|
||||
fn will_finish_launching(&self) {}
|
||||
|
||||
fn did_finish_launching(&self) {
|
||||
self.window.set_minimum_content_size(400., 400.);
|
||||
self.window.set_title("Hello World!");
|
||||
self.window.set_background_color(Color::rgb(255, 0,0));
|
||||
App::activate();
|
||||
|
||||
self.window.set_title("ILoader");
|
||||
self.window.set_title_visibility(TitleVisibility::Hidden);
|
||||
self.window.set_titlebar_appears_transparent(true);
|
||||
self.window.set_movable_by_background(true);
|
||||
self.window.set_autosave_name("CacaoILoader");
|
||||
self.window.set_content_view(&self.content);
|
||||
self.window.show();
|
||||
}
|
||||
|
||||
fn should_terminate_after_last_window_closed(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -30,5 +47,10 @@ fn main() {
|
||||
println!("{}", ipod_util::get_ipod_path().is_some());
|
||||
}
|
||||
}*/
|
||||
App::new("com.hello.world", BasicApp::default()).run();
|
||||
let config = WindowConfig::default();
|
||||
|
||||
App::new("com.alterdekim.iloader", ILoaderApp {
|
||||
window: Window::new(config),
|
||||
content: View::with(ScreenView::new())
|
||||
}).run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user