Skip to content

Commit

Permalink
Merge pull request #4 from AZProductions/wry
Browse files Browse the repository at this point in the history
Windows Implementation without a timer
  • Loading branch information
httnn authored Dec 29, 2022
2 parents 3b31337 + deed485 commit 5d6be4c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ mod mac_os;
#[cfg(target_os = "windows")]
mod windows;

#[cfg(target_os = "macos")]
use self::mac_os::{Timer};

#[cfg(target_os = "windows")]
use self::windows::{Timer};

use nih_plug::prelude::{Editor, GuiContext, ParamSetter};
use raw_window_handle::RawWindowHandle;
use serde_json::Value;
Expand Down Expand Up @@ -177,8 +182,10 @@ impl Editor for WebViewEditor {
let inner_context = self.context.clone();

let mut webview_builder = match parent.handle {
#[cfg(target_os = "macos")]
RawWindowHandle::AppKit(handle) => WebViewBuilder::new(Window { ns_view: handle.ns_view }).unwrap(),
RawWindowHandle::Win32(_handle) => todo!("Windows implementation."),
#[cfg(target_os = "windows")]
RawWindowHandle::Win32(_handle) => WebViewBuilder::new(Window { hwnd: _handle.hwnd}).unwrap(),
_ => panic!(),
};

Expand Down
25 changes: 12 additions & 13 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ pub struct Timer {}

impl Timer {
pub fn new(interval: f64, func: Box<dyn Fn()>) -> Box<Self> {
todo!()
Box::new(Self{})
}
}

impl Drop for Timer {
fn drop(&mut self) {
todo!()
}
}

Expand All @@ -25,16 +24,16 @@ unsafe impl Send for Timer {}

type Callback = Box<dyn Fn(&str)>;

impl NativeWebView {
pub fn new(handle: RawWindowHandle, source: Arc<HTMLSource>, size: (u32, u32), callback: Callback) -> Self {
todo!()
}
// impl NativeWebView {
// pub fn new(handle: RawWindowHandle, source: Arc<HTMLSource>, size: (u32, u32), callback: Callback) -> Self {
// todo!()
// }

pub fn set_size(&mut self, size: (u32, u32)) {
todo!()
}
// pub fn set_size(&mut self, size: (u32, u32)) {
// todo!()
// }

pub fn evaluate_javascript(&self, js: &str) {
todo!()
}
}
// pub fn evaluate_javascript(&self, js: &str) {
// todo!()
// }
// }

0 comments on commit 5d6be4c

Please sign in to comment.