Skip to content
6 changes: 3 additions & 3 deletions druid-shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ serde = ["kurbo/serde"]
[dependencies]
# NOTE: When changing the piet or kurbo versions, ensure that
# the kurbo version included in piet is compatible with the kurbo version specified here.
piet-common = "=0.5.0"
piet-common = { git = "https://github.com/linebender/piet", rev = "57cc49a8a88703b1c754a8c2c7f6f96007a24d4d" }
kurbo = "0.8.2"

tracing = "0.1.22"
Expand All @@ -67,7 +67,7 @@ features = ["d2d1_1", "dwrite", "winbase", "libloaderapi", "errhandlingapi", "wi
"d3d11", "dwmapi", "wincon", "fileapi", "processenv", "winbase", "handleapi",
"shellapi", "winnls"]

[target.'cfg(target_os="macos")'.dependencies]
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
block = "0.1.6"
cocoa = "0.24.0"
objc = "0.2.7"
Expand Down Expand Up @@ -96,7 +96,7 @@ version = "0.3.44"
features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent", "Navigator"]

[dev-dependencies]
piet-common = { version = "=0.5.0", features = ["png"] }
piet-common = { git = "https://github.com/linebender/piet", rev = "57cc49a8a88703b1c754a8c2c7f6f96007a24d4d", features = ["png"] }
static_assertions = "1.1.0"
test-log = { version = "0.2.5", features = ["trace"], default-features = false }
tracing-subscriber = { version = "0.3.2", features = ["env-filter"] }
Expand Down
42 changes: 42 additions & 0 deletions druid-shell/src/backend/ios/application.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! iOS implementation of features at the application scope.

use crate::application::AppHandler;

use super::clipboard::Clipboard;
use super::error::Error;

#[derive(Clone)]
pub(crate) struct Application;

impl Application {
pub fn new() -> Result<Application, Error> {
Ok(Application)
}

pub fn run(self, _handler: Option<Box<dyn AppHandler>>) {}

pub fn quit(&self) {}

pub fn clipboard(&self) -> Clipboard {
Clipboard
}

pub fn get_locale() -> String {
tracing::warn!("unimplemented");
"".to_string()
}
}
60 changes: 60 additions & 0 deletions druid-shell/src/backend/ios/clipboard.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Interactions with the system pasteboard on iOS.

use crate::clipboard::{ClipboardFormat, FormatId};

/// The browser clipboard.
#[derive(Debug, Clone, Default)]
pub struct Clipboard;

impl Clipboard {
/// Put a string onto the system clipboard.
pub fn put_string(&mut self, _s: impl AsRef<str>) {
tracing::warn!("unimplemented");
}

/// Put multi-format data on the system clipboard.
pub fn put_formats(&mut self, _formats: &[ClipboardFormat]) {
tracing::warn!("unimplemented");
}

/// Get a string from the system clipboard, if one is available.
pub fn get_string(&self) -> Option<String> {
tracing::warn!("unimplemented");
None
}

/// Given a list of supported clipboard types, returns the supported type which has
/// highest priority on the system clipboard, or `None` if no types are supported.
pub fn preferred_format(&self, _formats: &[FormatId]) -> Option<FormatId> {
tracing::warn!("unimplemented");
None
}

/// Return data in a given format, if available.
///
/// It is recommended that the `fmt` argument be a format returned by
/// [`Clipboard::preferred_format`]
pub fn get_format(&self, _format: FormatId) -> Option<Vec<u8>> {
tracing::warn!("unimplemented");
None
}

pub fn available_type_names(&self) -> Vec<String> {
tracing::warn!("unimplemented");
Vec::new()
}
}
26 changes: 26 additions & 0 deletions druid-shell/src/backend/ios/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! iOS backend errors.

#[derive(Debug, Clone)]
pub struct Error;

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "iOS Platform Error")
}
}

impl std::error::Error for Error {}
15 changes: 15 additions & 0 deletions druid-shell/src/backend/ios/menu.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

pub use crate::backend::shared::noop_menu::*;
24 changes: 24 additions & 0 deletions druid-shell/src/backend/ios/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! macOS druid-shell backend.

#![allow(clippy::let_unit_value)]

pub mod application;
pub mod clipboard;
pub mod error;
pub mod menu;
pub mod screen;
pub mod window;
26 changes: 26 additions & 0 deletions druid-shell/src/backend/ios/screen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2022 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! macOS Monitors and Screen information.

use crate::kurbo::Rect;
use crate::screen::Monitor;
use cocoa::base::id;
use cocoa::foundation::NSArray;
use objc::{class, msg_send, sel, sel_impl};

pub(crate) fn get_monitors() -> Vec<Monitor> {
tracing::warn!("unimplemented");
vec![]
}
Loading