csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
//
|
|
// Created by Dan Walmsley on 06/05/2022.
|
|
// Copyright (c) 2022 Avalonia. All rights reserved.
|
|
//
|
|
|
|
#include "WindowInterfaces.h"
|
|
#include "AvnView.h"
|
|
#include "WindowImpl.h"
|
|
#include "automation.h"
|
|
#include "menu.h"
|
|
#include "common.h"
|
|
#import "WindowBaseImpl.h"
|
|
#import "WindowProtocol.h"
|
|
#import <AppKit/AppKit.h>
|
|
#include "PopupImpl.h"
|
|
|
|
class PopupImpl : public virtual WindowBaseImpl, public IAvnPopup
|
|
{
|
|
private:
|
|
BEGIN_INTERFACE_MAP()
|
|
INHERIT_INTERFACE_MAP(WindowBaseImpl)
|
|
INTERFACE_MAP_ENTRY(IAvnPopup, IID_IAvnPopup)
|
|
END_INTERFACE_MAP()
|
|
virtual ~PopupImpl(){}
|
|
ComPtr<IAvnWindowEvents> WindowEvents;
|
|
PopupImpl(IAvnWindowEvents* events, IAvnGlContext* gl) : WindowBaseImpl(events, gl)
|
|
{
|
|
WindowEvents = events;
|
|
}
|
|
protected:
|
|
virtual NSWindowStyleMask GetStyle() override
|
|
{
|
|
return NSWindowStyleMaskBorderless;
|
|
}
|
|
|
|
virtual void OnInitialiseNSWindow () override
|
|
{
|
|
[Window setLevel:NSPopUpMenuWindowLevel];
|
|
}
|
|
|
|
public:
|
|
virtual bool ShouldTakeFocusOnShow() override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual HRESULT Show(bool activate, bool isDialog) override
|
|
{
|
|
return WindowBaseImpl::Show(activate, true);
|
|
}
|
|
};
|
|
|
|
|
|
extern IAvnPopup* CreateAvnPopup(IAvnWindowEvents*events, IAvnGlContext* gl)
|
|
{
|
|
@autoreleasepool
|
|
{
|
|
IAvnPopup* ptr = dynamic_cast<IAvnPopup*>(new PopupImpl(events, gl));
|
|
return ptr;
|
|
}
|
|
}
|
|
|