📄 pwin.h
字号:
/**
* Casts the event @p ev to xinput event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to xinput event
* @see Pw_Event
*/
#define Pw_EventCastToXInputEvent(_ev_) \
((Pw_XInputEvent*)&((_ev_)->xinput))
/**
* Casts the event @p ev to focus event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to focus event
* @see Pw_Event
*/
#define Pw_EventCastToFocusEvent(_ev_) \
((Pw_FocusEvent*)&((_ev_)->focus))
/**
* Casts the event @p ev to mapping event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to mapping event
* @see Pw_Event
*/
#define Pw_EventCastToMappingEvent(_ev_) \
((Pw_MappingEvent*)&((_ev_)->mapping))
/**
* Casts the event @p ev to reshape event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to reshape event
* @see Pw_Event
*/
#define Pw_EventCastToReshapeEvent(_ev_) \
((Pw_ReshapeEvent*)&((_ev_)->reshape))
/**
* Casts the event @p ev to destroy event.
* @param _ev_ event @p ev pointer
* @return pointer to event cast to destroy event
* @see Pw_Event
*/
#define Pw_EventCastToDestroyEvent(_ev_) \
((Pw_DestroyEvent*)&((_ev_)->destroy))
/* -------------------------------------------------------------------------- */
/**
* Gets the key code of key event @p ev.
* @param _ev_ key event @p ev pointer
* @return key code of key event
* @see Pw_KeyEvent
*/
#define Pw_KeyEventGetKeyCode(_ev_) \
((_ev_)->keycode)
/* -------------------------------------------------------------------------- */
/**
* Gets the number of xinput event @p ev.
* @param _ev_ xinput event @p ev pointer
* @return the number of xinput event.
* @see Pw_XInputEvent
*/
#define Pw_XInputEventGetNumber(_ev_) \
((_ev_)->num)
/**
* Gets the value of xinput event @p ev.
* @param _ev_ xinput event @p ev pointer
* @return the value of xinput event.
* @see Pw_XInputEvent
*/
#define Pw_XInputEventGetValue(_ev_) \
((_ev_)->val)
/* -------------------------------------------------------------------------- */
Pw_Window* Pw_WindowCreate(Pw_Window* parent,
Pw_Coord x,
Pw_Coord y,
Pw_Coord w,
Pw_Coord h,
Pw_Window* win);
void Pw_WindowDestroy(Pw_Window* win);
Pw_Bool Pw_WindowSetFocus(Pw_Window* win);
Pw_Bool Pw_WindowLeaveFocus(Pw_Window* win);
void Pw_WindowMap(Pw_Window* win);
void Pw_WindowUnmap(Pw_Window* win);
void Pw_WindowRepaint(Pw_Window* win);
void Pw_WindowRepaintPart(Pw_Window* win, Pw_Rectangle* clip);
void Pw_WindowSetXInputListener(Pw_Window* win, Pw_uInt num);
void Pw_WindowUnsetXInputListener(Pw_Window* win, Pw_uInt num);
void Pw_WindowSetShape(Pw_Window* win,
Pw_Coord x,
Pw_Coord y,
Pw_Coord w,
Pw_Coord h);
void Pw_WindowRaiseOne(Pw_Window* win);
void Pw_WindowLowerOne(Pw_Window* win);
void Pw_WindowPlaceAbove(Pw_Window* win, Pw_Window* rwin);
void Pw_WindowPlaceBelow(Pw_Window* win, Pw_Window* rwin);
void Pw_WindowPlaceOnTop(Pw_Window* win);
void Pw_WindowPlaceOnBottom(Pw_Window* win);
Pw_Int Pw_WindowGetNewClientDataId(void);
/* -------------------------------------------------------------------------- */
Pw_uInt Pw_FontGetStringWidth(Pw_Font* font, Pw_Char* string);
/* -------------------------------------------------------------------------- */
void Pw_DrawPoint(Pw_GC* gc, Pw_Coord x, Pw_Coord y);
void Pw_DrawRect(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord w,
Pw_Coord h);
void Pw_FillRect(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord w,
Pw_Coord h);
void Pw_DrawFrameRect(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
int w,
int h,
int t,
Pw_Char* Title);
void Pw_DrawLine(Pw_GC* gc,
Pw_Coord x1,
Pw_Coord y1,
Pw_Coord x2,
Pw_Coord y2);
void Pw_DrawCircle(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord r);
void Pw_FillCircle(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord r);
void Pw_DrawEllipse(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord rx,
Pw_Coord ry);
void Pw_FillEllipse(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Coord rx,
Pw_Coord ry);
void Pw_DrawBitmap(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Bitmap* bitmap);
void Pw_DrawString(Pw_GC* gc,
Pw_Coord x,
Pw_Coord y,
Pw_Char* string);
/* -------------------------------------------------------------------------- */
Pw_Bitmap* Pw_BitmapCreate(Pw_Coord width,
Pw_Coord height,
Pw_Byte* bits,
Pw_Bitmap* bitmap);
void Pw_BitmapDestroy(Pw_Bitmap* bitmap);
Pw_GC* Pw_BitmapCreateGC(Pw_Bitmap* bitmap, Pw_GC* gc);
void Pw_BitmapDestroyGC(Pw_GC* gc);
/* -------------------------------------------------------------------------- */
Pw_Timeout* Pw_TimeoutCreate(Pw_Display* dpy,
Pw_TimeoutCb cb,
Pw_Pointer data,
Pw_uLong time,
Pw_Timeout* to);
void Pw_TimeoutDestroy(Pw_Display* dpy, Pw_Timeout* to);
/* -------------------------------------------------------------------------- */
Pw_Int Pw_DisplayGetXInputValue(Pw_Display* dpy, Pw_uInt num);
/* -------------------------------------------------------------------------- */
Pw_Mat3d* Pw_Mat3dUnit(Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dScale(Pw_Float xs, Pw_Float ys, Pw_Float zs, Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dTranslate(Pw_Float xt, Pw_Float yt, Pw_Float zt, Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dRotX(Pw_Float theta, Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dRotY(Pw_Float theta, Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dRotZ(Pw_Float theta, Pw_Mat3d* m);
Pw_Mat3d* Pw_Mat3dMul(Pw_Mat3d* a, Pw_Mat3d* b, Pw_Mat3d* c);
void Pw_Mat3dTransform(Pw_Float x,
Pw_Float y,
Pw_Float z,
Pw_Int* xt,
Pw_Int* yt,
Pw_Int* zt,
Pw_Mat3d* m);
/* -------------------------------------------------------------------------- */
extern Pw_Font* F9x15_pwf;
extern Pw_Font* slkscr_pwf;
extern Pw_Font* slkscrb_pwf;
extern Pw_Font* time10b_pwf;
/* -------------------------------------------------------------------------- */
#define GRAPH_X0 20
#define GRAPH_Y0 13
#define GRAPH_H 152
#define GRAPH_W 262
#define GRAPH_ORIGIN_X GRAPH_X0
#define GRAPH_ORIGIN_Y (GRAPH_Y0+GRAPH_H)
#define TABLE_X0 0
#define TABLE_Y0 10
#define TABLE_W 286
#define TABLE_H 160
typedef void TCtrlCallBackFunc (Pw_Event* ev);
typedef void TResFunc (Pw_Window * win, int DialogResult);
typedef struct CONTROL_CREATE_INFO_struct CONTROL_CREATE_INFO;
typedef Pw_Window * CONTROLL_CREATE(const CONTROL_CREATE_INFO * ctrlInfo, Pw_Window* ParentWin, Pw_EventCb * cb) ;
//typedef struct _StringList StringList;
struct CONTROL_CREATE_INFO_struct {
CONTROLL_CREATE * ControllCreate;
void * Data;
unsigned int ID;
// Pw_RepaintCb cbPaint;
// Pw_EventCb cb;
unsigned int Param;
unsigned int Flags;
int FocusAccept;
int x0, y0;
int xSize, ySize;
int DefaultControl;
};
struct TInputLineData {
float * Value;
char Text[9];
int Digit;
int Dec;
float Inc;
float MinValue;
float MaxValue;
char * Format;
};
typedef struct _TGraphic TGraphic;
typedef enum {LOGARIPHM, LINEAR} TGraphicType;
struct _TGraphic {
Pw_Window Win;
TGraphicType GraphicType;
unsigned int ScrollPos;
unsigned int ScrollPage;
float ZoomX;
float ZoomY;
float MaxY;
float MinY;
int PointCount;
Pw_RepaintCb PointDrawMetod;
};
typedef struct _TLISTBOX TLISTBOX;
typedef char * (*GetListItem)(int);
struct _TLISTBOX {
Pw_Window Win;
unsigned int ScrollPos;
unsigned int ScrollPage;
unsigned int Selected;
unsigned int ItemCount;
GetListItem GetItem;
Pw_Font * Font;
};
Pw_Window * CreateButton (const CONTROL_CREATE_INFO *info_struct ,
Pw_Window * Parent,
Pw_EventCb cb);
Pw_Window * CreateInputLine (const CONTROL_CREATE_INFO *info_struct ,
Pw_Window * Parent, Pw_EventCb cb);
Pw_Window * CreateStaticText(const CONTROL_CREATE_INFO *info_struct ,
Pw_Window * Parent, Pw_EventCb cb) ;
Pw_Window * DialogCreate (const CONTROL_CREATE_INFO *info_struct ,
int CtrlCnt, Pw_Window * Parent,
TResFunc cb,
int x0, int y0, int width, int heigth) ;
Pw_Window * CreateQueryDialog(TResFunc ResProc , Pw_Window * Parent, char * Caption, char * ButtA, char * ButtB);
Pw_Window * CreateProgressBar (Pw_Window * Parent, Pw_EventCb cb, int * PtrValue, int x, int y, int w, int h);
Pw_Window * CreateListBox(Pw_Window * parent, TLISTBOX * list_box, GetListItem get_item, int count);
void DestroyProgressBar(Pw_Window * progbar);
int ProgressBarTime (Pw_Display* dpy, Pw_Pointer data);
void SetProgressStep (int step);
int MeasurementEventHandler (Pw_Event* ev);
void PrepareMeasurementWindowPaint(Pw_GC * gc);
void ExpDataTitlePaint(Pw_GC * gc) ;
void DialogFree(Pw_Window * dialog);
//int DEV_GUI_SendMessage(Pw_Window * win, DEV_GUI_MessageType msgtype, long data);
int DEV_GUI_SendMessage(Pw_Window * win, DEV_GUI_MessageType msgtype, void * data);
void MessageBox (int msg_type, char * msg_text);
TGraphic * CreateGraphic(Pw_Window * parent, TGraphic * graph, TGraphicType type, Pw_RepaintCb point_draw_metod, int cnt, int x, int y, int w, int h);
void DrawStandartModes(Pw_GC * gc);
void LoadDataFromFile(int sel);
void InitFileBrowser(void) ;
void InitExperiment_M1_Display(void);
void InitExperiment_M2_Display(void);
void InitCalibr_Display(void);
void ResetProgressBar(Pw_Window * progbar);
char * GetFileItem (int i);
Pw_Window * ShowMessage(Pw_Window* win, char * s);
void HideMessage (Pw_Window * win);
/* -------------------------------------------------------------------------- */
typedef struct {
int NumItems, v, PageSize;
} SCROLL_STATE;
typedef const char * GUI_ConstString;
typedef GUI_ConstString GUI_aConstString[];
#define countof(Array) (sizeof(Array) / sizeof(Array[0]))
/* -------------------------------------------------------------------------- */
void Pw_DrawGrayTextBackgr(Pw_GC *gc, int x, int y , int w, int h);
void HideAllMenu(void);
Pw_Window * GetTopChildVisibleVindow(Pw_Window * win);
/* -------------------------------------------------------------------------- */
#endif /* not PWIN_H */
//GLOBAL_PW_EXTRN struct TInputLineData InputLineData[6];
/*---------------------------------------------------------------------------
// end of pwin.h
//--------------------------------------------------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -