From 6c791a09b08b403819fbdb7166c3f0db62331e0e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 19 Apr 2023 09:50:21 +0200 Subject: [PATCH] tmp --- rust/Cargo.lock | 7 +++++++ rust/Cargo.toml | 3 ++- rust/window_classes/Cargo.toml | 20 ++++++++++++++++++++ rust/window_classes/src/base_window.rs | 18 ++++++++++++++++++ rust/window_classes/src/lib.rs | 2 ++ rust/window_classes/src/window_trait.rs | 20 ++++++++++++++++++++ 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 rust/window_classes/Cargo.toml create mode 100644 rust/window_classes/src/base_window.rs create mode 100644 rust/window_classes/src/lib.rs create mode 100644 rust/window_classes/src/window_trait.rs diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bbfafaa..7d2f77d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -126,6 +126,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "window_classes" +version = "0.1.0" +dependencies = [ + "windows", +] + [[package]] name = "windows" version = "0.38.0" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index de4f368..b2f6618 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -7,5 +7,6 @@ members = [ "input_processor", "itf_components", "numberkey_windows", - "ruststringrange" + "ruststringrange", + "window_classes", ] diff --git a/rust/window_classes/Cargo.toml b/rust/window_classes/Cargo.toml new file mode 100644 index 0000000..96704b4 --- /dev/null +++ b/rust/window_classes/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "window_classes" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +name = "window_classes" +crate-type = ["staticlib"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +[dependencies.windows] +version = "0.38.0" +features = [ + "Win32_Foundation", + "Win32_UI_WindowsAndMessaging", +] diff --git a/rust/window_classes/src/base_window.rs b/rust/window_classes/src/base_window.rs new file mode 100644 index 0000000..e47adf6 --- /dev/null +++ b/rust/window_classes/src/base_window.rs @@ -0,0 +1,18 @@ +use windows::Win32::Foundation::{HWND, RECT}; + +use crate::window_trait::Window; + +pub struct BaseWindow { + handle: HWND, + + // TODO: use Box<> + parent_window: *mut dyn Window, + ui_window: *mut dyn Window, + + timer_ui_obj: *mut dyn Window, + ui_obj_capture: *mut dyn Window, + + enable_virtual_window: bool, + visible_virtual_window: bool, + virtual_window_rect: RECT, +} diff --git a/rust/window_classes/src/lib.rs b/rust/window_classes/src/lib.rs new file mode 100644 index 0000000..3e6a9e1 --- /dev/null +++ b/rust/window_classes/src/lib.rs @@ -0,0 +1,2 @@ +pub mod base_window; +mod window_trait; diff --git a/rust/window_classes/src/window_trait.rs b/rust/window_classes/src/window_trait.rs new file mode 100644 index 0000000..2a7d6fa --- /dev/null +++ b/rust/window_classes/src/window_trait.rs @@ -0,0 +1,20 @@ +use windows::Win32::Foundation::HWND; + +use crate::base_window::BaseWindow; + +pub trait Window { + fn create( + atom: u16, + ex_style: u32, + style: u32, + parent_window: *mut dyn Window, + window_width: u16, + window_height: u16, + parent_window_handle: HWND, + ) where + Self: Sized; + + fn get_window() -> HWND + where + Self: Sized; +}