⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glw_w32.c

📁 Unique net-enabled GUI system based state of the art coding solutions with strong XML support.
💻 C
📖 第 1 页 / 共 4 页
字号:
  debug_End();  return((u32)win);}int glw_SetWindowState(u32 window, int state){  int ret=0;  struct glw_Window *win;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL)  {    ret=win->user_state;    win->user_state=state;  }  debug_End();  return(ret);}int glw_CloseWindow(u32 window){  struct glw_Window *win;  Node_t *node;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL)  {    node=glw_GetNode(win->window);    list_SetNodeData(node,NULL);    list_RemoveNode(windowlist,node);    list_DeleteNode(node);    node=glw_GetNode2(win->conn,win->window);    list_SetNodeData(node,NULL);    list_RemoveNode(win->conn->windowlist,node);    list_DeleteNode(node);    DestroyWindow(win->window);    glw_DeleteBuffer(win);    win->conn->window_count--;    if(win->conn->win==win)    {      WSAAsyncSelect(win->conn->sd,win->window,0,0);      if(NULL!=(node=list_GetNodeHead(win->conn->windowlist)))      {        struct glw_Window *w2;        if(NULL!=(w2=list_GetNodeData(node)))        {          win->conn->win=w2;          WSAAsyncSelect(win->conn->sd,w2->window,WM_APP,FD_READ);        }      }    }    mem_free(win);  }  debug_End();  return(0);}u32 glw_GetWindowUserdata(u32 window){  struct glw_Window *win;  u32 ret;  debug_Begin();  win=(struct glw_Window *)window;  ret=(win==NULL?0L:win->userdata);  debug_End();  return(ret);}int glw_SetWindowDimensions(u32 window, Rect_t *dim){//  struct glw_Window *win=(struct glw_Window *)window;  return(0);}void glw_SetWindowLimits(u32 window, int minwidth, int minheight, int maxwidth, int maxheight){  struct glw_Window *win;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL)  {    win->minwidth=minwidth;    win->minheight=minheight;    win->maxwidth=maxwidth;    win->maxheight=maxheight;  }  debug_End();}int glw_GetWindowDimensions(u32 window, Rect_t *dim){  struct glw_Window *win;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL)  {    dim->left=win->wrect.left;    dim->top=win->wrect.top;    dim->width=win->wrect.right-win->wrect.left;    dim->height=win->wrect.bottom-win->wrect.top;  }  debug_End();  return(0);}int glw_RefreshWindow(u32 window){  struct glw_Window *win;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL&&(win->flags&GLWF_SMART_REFRESH)!=0) glw_CopyBck(win,NULL);  debug_End();  return(0);}int glw_RefreshWindowPartial(u32 window, Rect_t *rect){  struct glw_Window *win;  RECT rct;  debug_Begin();  win=(struct glw_Window *)window;  if(win!=NULL&&(win->flags&GLWF_SMART_REFRESH)!=0)  {    rct.left=rect->left;    rct.top=rect->top;    rct.right=rect->left+rect->width;    rct.bottom=rect->top+rect->height;    glw_CopyBck(win,&rct);  }  debug_End();  return(0);}/** * \param TAG_GLW_WINDOW                    u32 */u32 glw_StartMouseTracking(u32 firsttag, ...){  return(glw_StartMouseTrackingTL((tag *)&firsttag));}u32 glw_StartMouseTrackingTL(tag *taglist){  u32 window;  struct glw_Window *win;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  win=(struct glw_Window *)window;  if(win!=NULL) SetCapture(win->window);  debug_End();  return(0L);}u32 glw_StopMouseTrackingTL(tag *taglist){  glw_StopMouseTracking();  return(0L);}void glw_StopMouseTracking(void){  debug_Begin();  ReleaseCapture();  debug_End();}/** * \param TAG_GLW_WINDOW                    u32 */u32 glw_DragWindow(u32 firsttag, ...){  return(glw_DragWindowTL((tag *)&firsttag));}u32 glw_DragWindowTL(tag *taglist){  u32 window;  struct glw_Window *win;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  win=(struct glw_Window *)window;  if(window!=0L) SendMessage(win->window,WM_SYSCOMMAND,SC_MOVE|0x0002,0);  debug_End();  return((u32)0);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_TYPE                      int */u32 glw_ResizeWindow(u32 firsttag, ...){  return(glw_ResizeWindowTL((tag *)&firsttag));}u32 glw_ResizeWindowTL(tag *taglist){  u32 window;  int type;  struct glw_Window *win;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  type=(int )tag_GetTagData(taglist,TAG_GLW_TYPE,0L);  win=(struct glw_Window *)window;  if(window!=0L) SendMessage(win->window,WM_SYSCOMMAND,SC_SIZE|type,0);  debug_End();  return((u32)0);}// graphics primitives/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_RGB                       u32 */u32 glw_SetColor(u32 firsttag, ...){  return(glw_SetColorTL((tag *)&firsttag));}u32 glw_SetColorTL(tag *taglist){  u32 window;  u32 rgb;  struct glw_Window *win;  u32 ret;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  rgb=(u32 )tag_GetTagData(taglist,TAG_GLW_RGB,0L);  win=(struct glw_Window *)window;  ret=win->fgrgb;  win->fgrgb=rgb;  if(rgb!=GLW_TRANSPARENT)  {    win->fgcol=RGB(rgb>>16,(rgb>>8)&0xff,rgb&0xff);    DeleteObject(win->fgbrush);    win->fgbrush=CreateSolidBrush(win->fgcol);    DeleteObject(win->pen);    win->logbrush.lbColor=win->fgcol;    win->pen=ExtCreatePen(PS_COSMETIC|PS_SOLID,1,&win->logbrush,0,NULL);  }  debug_End();  return((u32)ret);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_RGB                       u32 */u32 glw_SetBackground(u32 firsttag, ...){  return(glw_SetBackgroundTL((tag *)&firsttag));}u32 glw_SetBackgroundTL(tag *taglist){  u32 window;  u32 rgb;  struct glw_Window *win;  u32 ret;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  rgb=(u32 )tag_GetTagData(taglist,TAG_GLW_RGB,0L);  win=(struct glw_Window *)window;  ret=win->bgrgb;  win->bgrgb=rgb;  if(rgb!=GLW_TRANSPARENT)  {    win->bgcol=RGB(rgb>>16,(rgb>>8)&0xff,rgb&0xff);    DeleteObject(win->bgbrush);    win->bgbrush=CreateSolidBrush(win->bgcol);  }  debug_End();  return((u32)ret);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_X1                        int * \param TAG_GLW_Y1                        int * \param TAG_GLW_X2                        int * \param TAG_GLW_Y2                        int */u32 glw_DrawLine(u32 firsttag, ...){  return(glw_DrawLineTL((tag *)&firsttag));}u32 glw_DrawLineTL(tag *taglist){  u32 window;  int x1;  int y1;  int x2;  int y2;  struct glw_Window *win;///  HBITMAP hbmOld;  HPEN hbpOld;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  x1=(int )tag_GetTagData(taglist,TAG_GLW_X1,0L);  y1=(int )tag_GetTagData(taglist,TAG_GLW_Y1,0L);  x2=(int )tag_GetTagData(taglist,TAG_GLW_X2,0L);  y2=(int )tag_GetTagData(taglist,TAG_GLW_Y2,0L);  win=(struct glw_Window *)window;  if(win->fgrgb!=GLW_TRANSPARENT)  {///    hbmOld=SelectObject(win->hdcMem,win->hbmMem);    hbpOld=SelectObject(win->hdcMem,win->pen);    MoveToEx(win->hdcMem,x1,y1,NULL);    LineTo(win->hdcMem,x2,y2);    SelectObject(win->hdcMem,hbpOld);///    SelectObject(win->hdcMem,hbmOld);  }  debug_End();  return((u32)0);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_LEFT                      int * \param TAG_GLW_TOP                       int * \param TAG_GLW_WIDTH                     int * \param TAG_GLW_HEIGHT                    int */u32 glw_DrawRect(u32 firsttag, ...){  return(glw_DrawRectTL((tag *)&firsttag));}u32 glw_DrawRectTL(tag *taglist){  u32 window;  int left;  int top;  int width;  int height;  struct glw_Window *win;///  HBITMAP hbmOld;  HPEN hbpOld;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  left=(int )tag_GetTagData(taglist,TAG_GLW_LEFT,0L);  top=(int )tag_GetTagData(taglist,TAG_GLW_TOP,0L);  width=(int )tag_GetTagData(taglist,TAG_GLW_WIDTH,0L);  height=(int )tag_GetTagData(taglist,TAG_GLW_HEIGHT,0L);  win=(struct glw_Window *)window;  if(win->fgrgb!=GLW_TRANSPARENT)  {///    hbmOld=SelectObject(win->hdcMem,win->hbmMem);    hbpOld=SelectObject(win->hdcMem,win->pen);    MoveToEx(win->hdcMem,left,top,NULL);    LineTo(win->hdcMem,left+width,top);    LineTo(win->hdcMem,left+width,top+height);    LineTo(win->hdcMem,left,top+height);    LineTo(win->hdcMem,left,top);///    SelectObject(win->hdcMem,hbmOld);    SelectObject(win->hdcMem,hbpOld);  }  debug_End();  return((u32)0);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_LEFT                      int * \param TAG_GLW_TOP                       int * \param TAG_GLW_WIDTH                     int * \param TAG_GLW_HEIGHT                    int */u32 glw_DrawFilledRect(u32 firsttag, ...){  return(glw_DrawFilledRectTL((tag *)&firsttag));}u32 glw_DrawFilledRectTL(tag *taglist){  u32 window;  int left;  int top;  int width;  int height;  struct glw_Window *win;///  HBITMAP hbmOld;  RECT rc;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  left=(int )tag_GetTagData(taglist,TAG_GLW_LEFT,0L);  top=(int )tag_GetTagData(taglist,TAG_GLW_TOP,0L);  width=(int )tag_GetTagData(taglist,TAG_GLW_WIDTH,0L);  height=(int )tag_GetTagData(taglist,TAG_GLW_HEIGHT,0L);  win=(struct glw_Window *)window;  if(win->fgrgb!=GLW_TRANSPARENT)  {    rc.left=left;    rc.top=top;    rc.bottom=top+height;    rc.right=left+width;///    hbmOld=SelectObject(win->hdcMem,win->hbmMem);    FillRect(win->hdcMem,&rc,win->fgbrush);///    SelectObject(win->hdcMem,hbmOld);  }  debug_End();  return((u32)0);}/** * \param TAG_GLW_WINDOW                    u32 * \param TAG_GLW_X                         int * \param TAG_GLW_Y                         int */u32 glw_DrawPixel(u32 firsttag, ...){  return(glw_DrawPixelTL((tag *)&firsttag));}u32 glw_DrawPixelTL(tag *taglist){  u32 window;  int x;  int y;  struct glw_Window *win;///  HBITMAP hbmOld;  debug_Begin();  window=(u32 )tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);  x=(int )tag_GetTagData(taglist,TAG_GLW_X,0L);  y=(int )tag_GetTagData(taglist,TAG_GLW_Y,0L);  win=(struct glw_Window *)window;  if(win->fgrgb!=GLW_TRANSPARENT)  {///    hbmOld=SelectObject(win->hdcMem,win->hbmMem);    SetPixel(win->hdcMem,x,y,win->fgcol);///    SelectObject(win->hdcMem,hbmOld);  }  debug_End();  return((u32)0);}// event handlingint glw_MainLoop(u32 connection, u32 userdata, u32 mask){  struct glw_Connection *conn=(struct glw_Connection *)connection;  struct glw_Window *win=NULL;  MSG Message;  int r=1;  debug_Begin();  if(conn->cuser.quit==0)  {    conn->level++;    conn->curr_event.userdata=userdata;    conn->curr_event.event=GLWEV_SOCKET;    conn->curr_event.data=0;    if(0==(gui_Event((u32)conn,&conn->curr_event)))    {      while(r!=0)      {        conn->curr_event.mask=mask;        conn->curr_event.userdata=userdata;        if(conn->window_count>0)        {          win=NULL;          conn->curr_event.event=GLWEV_NOEVENT;          conn->curr_event.data=0;          while(conn->curr_event.event==GLWEV_NOEVENT)          {            r=GetMessage(&Message,NULL,0,0); // wait for message            win=glw_GetGlwWindow(Message.hwnd);            glw_FillEvent(&conn->curr_event,win);            TranslateMessage(&Message);      // keycode conversion            DispatchMessage(&Message);       // call StdWindowProc() (retval==StdWindowProc's retval)          }          if(win!=NULL)          {            win->done|=gui_Event((u32)conn,&win->conn->curr_event);//              if(win->done<0||r==0) conn->done=1;            if(win->done!=0)            {              break;            }          }          if(conn->completed<0) break;        }        else        {          conn->curr_event.event=GLWEV_NOEVENT;          conn->curr_event.window=0L;          conn->curr_event.mousex=conn->curr_event.mousey=0;          glw_ReadMessage(conn);          if(conn->curr_event.event!=GLWEV_NOEVENT)          {            if(0!=gui_Event((u32)conn,&conn->curr_event)) break;          }          if(conn->completed<0) break;        }      }    }    if(win!=NULL) win->done=0;    conn->level--;  }  debug_End();  return(0);}// font handling/** * \param TAG_GLW_FACE                      char * * \param TAG_GLW_SIZE                      int * \param TAG_GLW_STYLE                     u32 */u32 glw_OpenFont(u32 firsttag, ...){  return(glw_OpenFontTL((tag *)&firsttag));}u32 glw_OpenFontTL(tag *taglist){  char *face;  int size;  u32 style;  struct glw_FontFace *fface;  struct glw_Font *font=NULL;  Node_t *node;  debug_Begin();  face=(char *)tag_GetTagData(taglist,TAG_GLW_FACE,0L);  size=(int )tag_GetTagData(taglist,TAG_GLW_SIZE,0L);  style=(u32 )tag_GetTagData(taglist,TAG_GLW_STYLE,0L);  if(NULL!=(fface=glw_GetFaceWinName(fontfacelist,face)))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -