📄 window.h
字号:
//**************************************************************//* filename: window.h *//* *//**************************************************************//* programmed by: Thomas Wagner *//* last change: (XXX: not updated) *//**************************************************************#include <stdio.h>#include <stdlib.h>#include <X11/Xlib.h>#include <X11/Xutil.h>class Window_Info;class Big_Window;#ifndef WINDOW_H#define WINDOW_H#define FALSE 0#define TRUE 1#define DEFAULT_FONT "fixed"#define DEFAULT_BDWIDTH 1#define MAX(a,b) (((a) > (b)) ? (a) : (b))#define MIN(a,b) (((a) < (b)) ? (a) : (b))class Window_Info{#if 0 protected:#else public:#endif Window window; GC gc; Display *display; XFontStruct *fontstruct; short x, y, height, width; char *text; public: Window_Info (Display * initdisplay, GC initgc, Window Parentwindow, XFontStruct * fontstruct, short initx, short inity, short initwidth, short initheight, char *inittext, int borderwidth); virtual ~ Window_Info (); virtual void HandleEvent (XEvent * Event) = NULL; void SetWindowName (char *newname); void SetIconName (char *newname);// sets the selected events void SetSelectedInput (long input) { XSelectInput (display, window, input); } // add an event to eventmask void AddSelectedInput (long input);// remove an event from eventmask void DelSelectedInput (long input);// DrawBorder draws a border on drawable, to make it look Motif-like void DrawBorder (Drawable drawable, unsigned int borderstatus) { DrawBorder (drawable, 0, 0, width, height, 0, 0, NULL, borderstatus); } void DrawBorder (Drawable drawable, unsigned int x, unsigned int y, unsigned int borderwidth, unsigned int borderheight, unsigned int textx, unsigned int texty, char *bordertext, unsigned int borderstatus); virtual void UnmapMe () { XUnmapWindow (display, window); } virtual void MapMe () { XMapWindow (display, window); } inline Window GetWindow () { return window; } inline int Getx () { return x; } inline int Gety () { return y; } inline int Getwidth () { return width; } inline int Getheight () { return height; } inline GC Getgc () { return gc; } inline Display *Getdisplay () { return display; } inline char *Gettext () { return text; } inline void SetBorderColor (unsigned long color) { XSetWindowAttributes xswa; xswa.border_pixel = color; XChangeWindowAttributes (display, window, CWBorderPixel, &xswa); } void FixMySize (); void SetMinSize (short minwidth, short minheight); inline void SizeMe (unsigned short newwidth, unsigned short newheight) { height = newheight; width = newwidth; XResizeWindow (display, window, width, height); } inline void RaiseMe () { XRaiseWindow (display, window); } inline void ResizeMe (short xdiff, short ydiff) { height += ydiff; width += xdiff; XResizeWindow (display, window, width, height); } inline void PlaceMe (unsigned short newx, unsigned short newy) { x = newx; y = newy; XMoveWindow (display, window, x, y); } inline virtual void MoveMe (short xdiff, short ydiff) { x += xdiff; y += ydiff; XMoveWindow (display, window, x, y); }};class BigWindow: public Window_Info{ public: BigWindow (Display * initdisplay, GC initgc, Window Parentwindow, XFontStruct * fontstruct, short initx, short inity, short initwidth, short initheight, char *inittext, int borderwidth); virtual void Action (int actionnumber, int value) = NULL;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -