📄 messagebox.c
字号:
#include <Stddef.h>
#include "reg167.h"
#include <intrins.h>
#include <rtx166t.h>
#include <ABSACC.H>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <membox.h>
#include "GUI.h"
#include "Globalvars.h"
#include "pwin.h"
#include "guidebug.h"
#include "i_pwin.h"
#define MSG_DEFAULT_FONT F9x15_pwf
Pw_Window * OnTopFocusWin;
Pw_Window msg_win;
int MsgBoxTask;
const char * MSG_TYPE_TEXT[] = {
" ", "ERROR", "WARNING", "INFORMATION"
};
//-------------------------------------------
void SendToHost(char * str, INT16U t) ;
void Beep();
//-------------------------------------------
void MsgBoxRepaint(Pw_GC * gc) {
Pw_Coord w, h;
int x, y, ty;
const char * sm;
Pw_WindowGetSize(&msg_win, &w, &h);
Pw_GCSetFont(gc, MSG_DEFAULT_FONT);
Pw_GCSetColor(gc, pw_white_pixel);
Pw_DrawFrameRect(gc, 0, 0, w, h, 3, NULL);
ty = Pw_GCGetFontHeight(gc);
Pw_GCSetColor(gc, pw_white_pixel);
Pw_FillRect(gc, 0, 0, w, ty + 9);
sm = MSG_TYPE_TEXT[Pw_WindowGetClientDataId(&msg_win)];
x = (w - Pw_FontGetStringWidth(gc->font, sm))/2;
y = ty + 4;
Pw_GCSetColor(gc, pw_black_pixel);
Pw_DrawString(gc, x, y, sm);
sm = Pw_WindowGetClientData(&msg_win);
y = y * 3 - ty/2;
x = (w - Pw_FontGetStringWidth(gc->font, sm))/2;
Pw_GCSetColor(gc, pw_white_pixel);
Pw_DrawString(gc, x, y, sm);
y = h - 2*ty;
x = w/2 - 20;
Pw_GCSetColor(gc, pw_white_pixel);
Pw_FillRect(gc, x, y, 40, ty+4);
x = (w - Pw_FontGetStringWidth(gc->font, "OK"))/2;
y = y + ty;
Pw_GCSetColor(gc, pw_black_pixel);
Pw_DrawString(gc, x, y, "OK");
}
//-------------------------------------------
int MsgBoxEventHandler(Pw_Event * ev) {
//Pw_Window * win;
switch (Pw_EventGetType(ev)) {
case Pw_KeyPressEventType:
Pw_WindowUnmap(&msg_win);
// win = Pw_WindowGetWindowAbove(&msg_win);
Pw_WindowDestroy(&msg_win);
if (OnTopFocusWin)
Pw_WindowSetFocus(OnTopFocusWin);
Pw_WindowRepaint(Desktop);
// else
// 昨
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -