Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic component development support #1600

Merged
merged 3 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn gen_class(def: &TypeDef, gen: &Gen) -> TokenStream {
let new = if def.has_default_constructor() {
quote! {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(
callback: F,
Expand Down
1 change: 1 addition & 0 deletions crates/libs/bindgen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct Gen<'a> {
pub min_inherit: bool,
pub min_xaml: bool,
pub windows_extern: bool,
pub component: bool,
}

impl Gen<'_> {
Expand Down
4 changes: 2 additions & 2 deletions crates/libs/bindgen/src/implements.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::*;

pub fn gen(def: &TypeDef, gen: &Gen) -> TokenStream {
if def.kind() != TypeKind::Interface || !def.can_implement() {
if def.kind() != TypeKind::Interface || (!gen.component && !def.can_implement()) {
return quote! {};
}

Expand Down Expand Up @@ -58,7 +58,7 @@ pub fn gen(def: &TypeDef, gen: &Gen) -> TokenStream {
// If it can be implemented but is exclusive and has no return value then
// it is a Xaml override so give it a default implementation to make it easier
// to override individual methods for Xaml notifications.
if def.is_exclusive() && method.signature(&def.generics).return_type.is_none() {
if !gen.component && def.is_exclusive() && method.signature(&def.generics).return_type.is_none() {
quote! {
fn #name #signature {
::core::result::Result::Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/windows/src/Windows/AI/MachineLearning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@ unsafe impl ::core::marker::Sync for LearningModelSession {}
pub struct LearningModelSessionOptions(::windows::core::IUnknown);
impl LearningModelSessionOptions {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<LearningModelSessionOptions, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ unsafe impl ::windows::core::RuntimeType for AppServiceClosedStatus {
pub struct AppServiceConnection(::windows::core::IUnknown);
impl AppServiceConnection {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AppServiceConnection, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod DataProvider;
pub struct Appointment(::windows::core::IUnknown);
impl Appointment {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<Appointment, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down Expand Up @@ -1535,7 +1535,7 @@ unsafe impl ::core::marker::Sync for AppointmentException {}
pub struct AppointmentInvitee(::windows::core::IUnknown);
impl AppointmentInvitee {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AppointmentInvitee, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down Expand Up @@ -2030,7 +2030,7 @@ unsafe impl ::core::marker::Sync for AppointmentManagerForUser {}
pub struct AppointmentOrganizer(::windows::core::IUnknown);
impl AppointmentOrganizer {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AppointmentOrganizer, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down Expand Up @@ -2434,7 +2434,7 @@ impl ::windows::core::RuntimeName for AppointmentProperties {
pub struct AppointmentRecurrence(::windows::core::IUnknown);
impl AppointmentRecurrence {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AppointmentRecurrence, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down Expand Up @@ -3774,7 +3774,7 @@ unsafe impl ::windows::core::RuntimeType for FindAppointmentCalendarsOptions {
pub struct FindAppointmentsOptions(::windows::core::IUnknown);
impl FindAppointmentsOptions {
pub fn new() -> ::windows::core::Result<Self> {
Self::IActivationFactory(|f| f.activate_instance::<Self>())
Self::IActivationFactory(|f| f.ActivateInstance::<Self>())
}
fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<FindAppointmentsOptions, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new();
Expand Down
Loading