Compare commits

...

2 Commits

Author SHA1 Message Date
Cheney
a725c59c5e tray 未调试通过 2024-08-20 17:53:46 +08:00
Cheney
6f68c87114 动态窗口测试通过 2024-08-20 15:40:27 +08:00
6 changed files with 106 additions and 18 deletions

View File

@ -4,6 +4,10 @@
## TODO
[ ] 静态 tray
[ ] 动态 tray
[ ] 日志模块
### 1.0
[x] 窗口大小配置
[ ] 后台服务启动/守护
[x] 前台页面
[x] 日志模块
[ ] tray
[ ] tray 右键

14
aardiowin/Readme.md Normal file
View File

@ -0,0 +1,14 @@
## 编译
1. 使用 aardio 打开项目
## 辅助 AI
https://yuanqi.tencent.com/agent/ZsUaavawqWFp
## 托盘
https://bbs.aardio.com/forum.php?mod=viewthread&tid=10257&highlight=%E6%89%98%E7%9B%98

View File

@ -1,7 +1,7 @@
{
"app" : "awin",
"title" : "awin",
"icon" : "",
"icon" : "logo.png",
"backend" : "",
"frontend" : "",
"window" : {

View File

@ -24,9 +24,10 @@ namespace init{
// 配置载入函数
loadConfigs = function() {
import io;
import util;
gLog.print("dir");
gLog.print("loadConfigs");
var configs = {};
var currentPath = fsys.getCurDir();
gLog.print("currentPath", currentPath);
@ -63,6 +64,7 @@ namespace init{
object.merge(configs, appDataConfig, true);
}
gLog.print("configs", util.table.stringify(configs, true));
return configs;
};

BIN
aardiowin/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,21 +1,89 @@
import win.ui;
import init;
import win.util.tray;
// 初始化
init.init();
var gConfig = init.loadConfigs();
var gDebug = init.getDebug();
// 启动界面
/*DSG{{*/
mainForm = win.form(text="awin";right=gConfig.window.width;bottom=gConfig.window.height;border="thin";max=false;min=false)
mainForm = win.form(text="awin";right=1;bottom=1;border="thin";max=false;min=false)
mainForm.add()
/*}}*/
// 启动界面
// 日志
var gLog = init.getLog();
gLog.print("web view")
gLog.print("width=" , gConfig.window.width)
gLog.print("height=" , gConfig.window.height)
// 主窗口
mainForm.resize(gConfig.window.width, gConfig.window.height);
// 托盘
//var trayIcon = win.util.tray(mainForm, gConfig.icon, "双击打开主界面");
//trayIcon.orphanWindow(true);
//trayIcon.show();
var icon = {
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xf8\31\xff\xff\xe7\xe7\xff\xff\xdf\xfb\xff\xff\xbf\xfd\xff\xff\xbe}\xff\xff}\xbe\xff\xff\x7f\xfe\xff\xff\x7f\xfe\xff\xff\x7f\xfe\xff\xffs\xce\xff\xffs\xce\xff\xff\xbf\xfd\xff\xff\xbf\xfd\xff\xff\xdf\xfb\xff\xff\xe7\xe7\xff\xff\xf8\31\xff\xff';
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\x81\xff\xff\x7e\x7e\xff\xff\xbd\xff\xff\xff\xdb\xff\xff\xff\xdb\xe7\xff\xff\xe7\xdb\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7<\xff\xff\xe7<\xff\xff\xdb\xff\xff\xff\xdb\xff\xff\xff\xbd\xff\xff\xff\x7e\x7e\xff\xff\xff\x81\xff\xff';
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\31\xf8\xff\xff\xe7\xe7\xff\xff\xfb\xdf\xff\xff\xfd\xbf\xff\xff}\xbe\xff\xff\xbe}\xff\xff\xfe\x7f\xff\xff\xfe\x7f\xff\xff\xfe\x7f\xff\xff\xces\xff\xff\xces\xff\xff\xfd\xbf\xff\xff\xfd\xbf\xff\xff\xfb\xdf\xff\xff\xe7\xe7\xff\xff\31\xf8\xff\xff';
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81\xff\xff\xff\x7e\x7e\xff\xff\xff\xbd\xff\xff\xff\xdb\xff\xff\xe7\xdb\xff\xff\xdb\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff<\xe7\xff\xff<\xe7\xff\xff\xff\xdb\xff\xff\xff\xdb\xff\xff\xff\xbd\xff\xff\x7e\x7e\xff\xff\x81\xff\xff\xff';
}
var currectIcon = 1;
var tray = win.util.tray(mainForm, icon[currectIcon], mainForm.text);
var tmId = mainForm.setInterval(
120,
function(id) {
currectIcon = currectIcon == 4 ? 1 : currectIcon + 1;
tray.icon = icon[currectIcon];
}
);
//下面是添加托盘右键菜单
import win.ui.menu;
mainForm.popmenu=win.ui.popmenu(mainForm);
mainForm.popmenu.add('打开',function(id){ //添加了一个打开主界面的菜单
mainForm.show();
})
mainForm.popmenu.add('退出',function(id){ //添加了一个退出程序的菜单
mainForm.close()
})
//下面是获取鼠标消息弹出上面的右键菜单
import mouse;
mainForm.wndproc = function(hwnd,message,wparam,lparam){
select(message) {//判断消息类型
case( 0x400+9981/*_WM_TRAYMESSAGE*/ ) { //托盘图标消息
if(lparam = 0x203/*_WM_LBUTTONDBLCLK)*/){ //鼠标双击
mainForm.show(true);
}
elseif(lparam =0x205/*_WM_RBUTTONUP*/){ //鼠标右键
x,y = mouse.getPos();
win.setForeground(mainForm.hwnd)
mainForm.popmenu.popup(x,y,true)
}
}
case( 0x112/*_WM_SYSCOMMAND*/ ){ //系统命令消息
if( wparam == 0xF020/*_SC_MINIMIZE*/ ){ //用户点击了最小化按钮
mainForm.show(false); //隐藏窗口
return true;//阻击默认消息传递,取消最小化过程
}
}
}
}
mainForm.onClose = function(hwnd,message,wParam,lParam){
tray.delete(); //关闭窗口同时删掉托盘,避免关闭窗口后要鼠标移到托盘图标才消失
}
// 前端
import web.view;
var theView = web.view(mainForm);
@ -45,4 +113,4 @@ if( gDebug ){
mainForm.show();
win.loopMessage();
tray.delete();