📄 pwin.h
字号:
* @param _win_ window @p win pointer
* @param _w_ new width of window
* @param _h_ new height of window
* @see Pw_Window
*/
#define Pw_WindowSetSize(_win_, _w_, _h_) \
Pw_WindowSetShape((_win_), \
(_win_)->area.x, \
(_win_)->area.y, \
(_w_), \
(_h_))
/**
* Gets the shape of window @p win.
* @param _win_ window @p win pointer
* @param _xp_ pointer to x position of window (returned)
* @param _yp_ pointer to y position of window (returned)
* @param _wp_ pointer to width of window (returned)
* @param _hp_ pointer to height of window (returned)
* @see Pw_Window
*/
#define Pw_WindowGetShape(_win_, _xp_, _yp_, _wp_, _hp_) \
PW_MACRO_START \
*(_xp_) = (_win_)->area.x; \
*(_yp_) = (_win_)->area.y; \
*(_wp_) = (_win_)->area.w; \
*(_hp_) = (_win_)->area.h; \
PW_MACRO_END
/**
* Sets the focus acceptance of window @p win.
* @param _win_ window @p win pointer
* @see Pw_Window
*/
#define Pw_WindowSetFocusAccept(_win_, _accept_) \
((_win_)->focus_accept = (_accept_))
/**
* Checks if window @p win is in focus.
* @param _win_ window @p win pointer
* @return true if window is in focus
* @see Pw_Window
*/
#define Pw_WindowIsInFocus(_win_) \
((_win_)->dpy->focus_win == (_win_))
/**
* Checks if window @p win is mapped.
* @param _win_ window @p win pointer
* @return true if window is mapped
* @see Pw_Window
*/
#define Pw_WindowIsMapped(_win_) \
((_win_)->mapped)
/**
* Gets the repaint callback of window @p win.
* @param _win_ window @p win pointer
* @return the repaint callback of window
* @see Pw_Window
*/
#define Pw_WindowGetRepaintCallback(_win_) \
((_win_)->repaint_cb)
/**
* Sets the repaint callback for window @p win.
* @param _win_ window @p win pointer
* @param _cb_ new repaint callback
* @see Pw_Window
*/
#define Pw_WindowSetRepaintCallback(_win_, _cb_) \
((_win_)->repaint_cb = (_cb_))
/**
* Gets the event callback of window @p win.
* @param _win_ window @p win pointer
* @return the event callback of window
* @see Pw_Window
*/
#define Pw_WindowGetEventCallback(_win_) \
((_win_)->event_cb)
/**
* Sets the event callback for window @p win.
* @param _win_ window @p win pointer
* @param _cb_ new event callback
* @see Pw_Window
*/
#define Pw_WindowSetEventCallback(_win_, _cb_) \
((_win_)->event_cb = (_cb_))
/**
* Gets the client data of window @p win.
* @param _win_ window @p win pointer
* @return the client data of window
* @see Pw_Window
*/
#define Pw_WindowGetClientData(_win_) \
((_win_)->cdata)
/**
* Sets the client data for window @p win.
* @param _win_ window @p win pointer
* @param _data_ new client data
* @see Pw_Window
*/
#define Pw_WindowSetClientData(_win_, _data_) \
((_win_)->cdata = (_data_))
/**
* Gets the client data id of window @p win.
* @param _win_ window @p win pointer
* @return the client data id of window
* @see Pw_Window
*/
#define Pw_WindowGetClientDataId(_win_) \
((_win_)->cdata_id)
/**
* Sets the client data id for window @p win.
* @param _win_ window @p win pointer
* @param _data_ new client data id
* @see Pw_Window
*/
#define Pw_WindowSetClientDataId(_win_, _id_) \
((_win_)->cdata_id = (_id_))
/**
* Gets the top child window of window @p win.
* @param _win_ window @p win pointer
* @return the top child window of window
* @see Pw_Window
*/
#define Pw_WindowGetChildWindowOnTop(_win_) \
((_win_)->children)
/**
* Gets the window above window @p win.
* @param _win_ window @p win pointer
* @return the window above window
* @see Pw_Window
*/
#define Pw_WindowGetWindowAbove(_win_) \
((_win_)->prev)
/**
* Gets the window below window @p win.
* @param _win_ window @p win pointer
* @return the window below window
* @see Pw_Window
*/
#define Pw_WindowGetWindowBelow(_win_) \
((_win_)->next)
/* -------------------------------------------------------------------------- */
/**
* Gets the height of font @p font.
* @param _font_ font @p font pointer
* @return the height of font
* @see Pw_Font
*/
#define Pw_FontGetHeight(_font_) \
((_font_)->ascent + (_font_)->descent)
/**
* Gets the ascent of font @p font.
* @param _font_ font @p font pointer
* @return the ascent of font
* @see Pw_Font
*/
#define Pw_FontGetAscent(_font_) \
((_font_)->ascent)
/**
* Gets the descent of font @p font.
* @param _font_ font @p font pointer
* @return the descent of font
* @see Pw_Font
*/
#define Pw_FontGetDescent(_font_) \
((_font_)->descent)
/* -------------------------------------------------------------------------- */
/**
* Gets the type of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return the type of graphic context
* @see Pw_GC
*/
#define Pw_GCGetType(_gc_) \
((_gc_)->d.type)
/**
* Gets the window component of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return pointer to window component of graphic context
* @see Pw_GC
*/
#define Pw_GCGetWindow(_gc_) \
((_gc_)->d.comp.window)
/**
* Gets the bitmap component of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return pointer to bitmap component of graphic context
* @see Pw_GC
*/
#define Pw_GCGetBitmap(_gc_) \
((_gc_)->d.comp.bitmap)
/**
* Gets the current font width of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return the current font width of graphic context
* @see Pw_GC
*/
#define Pw_GCGetFontWidth(_gc_) \
((_gc_)->font->width)
/**
* Gets the current font height of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return the current font height of graphic context
* @see Pw_GC
*/
#define Pw_GCGetFontHeight(_gc_) \
((_gc_)->font->ascent + (_gc_)->font->descent)
/**
* Gets the current font ascent of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return the current font ascent of graphic context
* @see Pw_GC
*/
#define Pw_GCGetFontAscent(_gc_) \
((_gc_)->font->ascent)
/**
* Gets the current font descent of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return the current font descent of graphic context
* @see Pw_GC
*/
#define Pw_GCGetFontDescent(_gc_) \
((_gc_)->font->descent)
/**
* Gets the current color of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return pointer to current color of graphic context
* @see Pw_GC
*/
#define Pw_GCGetColor(_gc_) \
((_gc_)->color)
/**
* Sets the new color @p color of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @param _color_ new color @p color pointer
* @see Pw_GC
*/
#define Pw_GCSetColor(_gc_, _color_) \
((_gc_)->color = (_color_));
/**
* Gets the current font of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @return pointer to current font of graphic context
* @see Pw_GC
*/
#define Pw_GCGetFont(_gc_) \
((_gc_)->font)
/**
* Sets the new font @p font of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @param _font_ new font @p font pointer
* @see Pw_GC
*/
#define Pw_GCSetFont(_gc_, _font_) \
((_gc_)->font = (_font_))
/**
* Gets the string width in graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @param _string_ zero terminated string
* @return string width in pixels
* @see Pw_GC
*/
#define Pw_GCGetStringWidth(_gc_, _string_) \
Pw_FontGetStringWidth((_gc_)->font, _string_)
/**
* Changes the position of (0, 0) point of graphic context @p gc.
* @param _gc_ graphic context @p gc pointer
* @param _xt_ x axis translation
* @param _yt_ y axis translation
* @see Pw_GC
*/
#define Pw_GCTranslate(_gc_, _xt_, _yt_) \
((_gc_)->xoff += (_xt_), (_gc_)->yoff += (_yt_))
/* -------------------------------------------------------------------------- */
/**
* Gets the width of bitmap @p bitmap.
* @param _bitmap_ bitmap @p bitmap pointer
* @return the width of bitmap.
* @see Pw_Bitmap
*/
#define Pw_BitmapGetWidth(_bitmap_) \
((_bitmap_)->width)
/**
* Gets the height of bitmap @p bitmap.
* @param _bitmap_ bitmap @p bitmap pointer
* @return the height of bitmap.
* @see Pw_Bitmap
*/
#define Pw_BitmapGetHeight(_bitmap_) \
((_bitmap_)->height)
/* -------------------------------------------------------------------------- */
/**
* Gets the timeout trigger time @p to.
* @param _to_ timeout @p to pointer
* @return the trigger time of timeout.
* @see Pw_Timeout
*/
#define Pw_TimeoutGetTime(_to_) \
((_to_)->time)
/**
* Sets the timeout @p to trigger time.
* @param _to_ timeout @p to pointer
* @param _time_ new trigger time
* @see Pw_Timeout
*/
#define Pw_TimeoutSetTime(_to_, _time_) \
((_to_)->time_left = (_to_)->time = _time_)
/**
* Gets the time left to timeout @p to trigger
* @param _to_ timeout @p to pointer
* @return the time left to timeout trigger
* @see Pw_Timeout
*/
#define Pw_TimeoutGetLeftTime(_to_) \
((_to_)->time_left)
/**
* Refreshes the timeout @p to (i.e. sets the time left to trigger time)
* @param _to_ timeout @p to pointer
* @see Pw_Timeout
*/
#define Pw_TimeoutRefresh(_to_) \
((_to_)->time_left = (_to_)->time)
/* -------------------------------------------------------------------------- */
/**
* Gets the type of event @p ev.
* @param _ev_ event @p ev pointer
* @return the type of event
* @see Pw_Event
*/
#define Pw_EventGetType(_ev_) \
((_ev_)->data.type)
/**
* Gets the window from wich event @p ev originated.
* @param _ev_ event @p ev pointer
* @return the window of event
* @see Pw_Event
*/
#define Pw_EventGetWindow(_ev_) \
((_ev_)->data.win)
/**
* Casts the event @p ev to key event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to key event
* @see Pw_Event
*/
#define Pw_EventCastToKeyEvent(_ev_) \
((Pw_KeyEvent*)&((_ev_)->key))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -