📄 errorbox.cc
字号:
//**************************************************************//* filename: errorbox.cc *//* *//**************************************************************//* programmed by: Thomas Wagner *//* last change: (XXX: not updated) *//**************************************************************#include <stdio.h>#include <stdlib.h>#include <string.h>#include "errorbox.h"extern unsigned long whitepix, redpix;extern Cursor waitcursor;ErrorBox::ErrorBox (Display * initdisplay, GC initgc, MainWindow * Parentwindow, XFontStruct * initfontstruct, int initx, int inity, int initwidth, int initheight):Window_Info (initdisplay, initgc, Parentwindow->GetWindow (), initfontstruct, initx, inity, initwidth, initheight, NULL, 1){ ChangeText (text); SetSelectedInput (ExposureMask | ButtonPressMask);}void ErrorBox::Redraw (){ XSetForeground (display, gc, redpix); XFillRectangle (display, window, gc, 0, 0, width, height); XSetForeground (display, gc, whitepix); if (text != NULL) { short textx, texty; textx = (int) ((width - XTextWidth (fontstruct, text, strlen (text))) * .5) + 1; texty = (int) ((height + fontstruct->max_bounds.ascent + fontstruct->max_bounds.descent) * .5 - fontstruct->max_bounds.descent); XDrawString (display, window, gc, textx, texty, text, strlen (text)); }}void ErrorBox::ChangeText (char *newtext){ text = newtext; Redraw ();}void ErrorBox::HandleEvent (XEvent * Event){ switch (Event->type) { case Expose: if (Event->xexpose.count == 0) Redraw (); break; case ButtonPress: if (Event->xbutton.button == Button1) UnmapMe (); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -