gpt4 book ai didi

java - 如何通过JRuby在SWT/Shoes中获得macOS透明标题栏效果

转载 作者:太空宇宙 更新时间:2023-11-04 10:47:00 25 4
gpt4 key购买 nike

我试图在使用 Shoes 时获得这种效果(透明标题栏和全尺寸内容)。但是,我认为 SWT 甚至不提供此选项。

Transparent Title Bar

我怎样才能实现这个目标?

最佳答案

这就是我实现的目标:

我将此代码放在我的 Shoes.app 声明之前

class Shoes
module Swt
class App
def initialize_shell
@image = ::Swt::Graphics::Image.new(::Swt.display, ICON)
@shell = ::Swt::Widgets::Shell.new(::Swt.display, main_window_style)
@shell.image = @image
@shell.text = @dsl.app_title
@shell.background_mode = ::Swt::SWT::INHERIT_DEFAULT
@shell.background = @background.real
full_size_byte_mask = 32768

hack_cocoa_main_window('setTitleVisibility:', 1)
hack_cocoa_main_window('setStyleMask:', @shell.view.window.styleMask | full_size_byte_mask)
hack_cocoa_main_window('setTitlebarAppearsTransparent:', 1)
end

private

def hack_cocoa_main_window(key, value, type=nil)
key = org.eclipse.swt.internal.cocoa::OS.sel_registerName(key)
id = @shell.view.window.id
msg_method = ['objc_msgSend', type].compact.join('_')
org.eclipse.swt.internal.cocoa::OS.send(msg_method, id, key, value)
end
end
end
end

关于java - 如何通过JRuby在SWT/Shoes中获得macOS透明标题栏效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48287971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com