VOID ClkPaint (HWND hwnd) { RECTL rclUpdate; HPS hpsWnd; if (cp.usDispMode & DM_ANALOG) { WinBeginPaint (hwnd, hps, &rclUpdate); GpiCreateLogColorTable (hps, 0L, LCOLF_RGB, 0L, 0L, (PLONG)NULL); WinFillRect (hps, &rclUpdate, cp.clrBackground); if (fBufferDirty) { DrawClock (hpsBuffer); fBufferDirty = FALSE; } UpdateScreen (hps, &rclUpdate); /* * Draw the second hand last, so xor will work. */ if (fShowSecondHand && (cp.usDispMode & DM_SECONDHAND)) ClkDrawHand(hps, HT_SECOND, dt.seconds); WinEndPaint (hps); } else { /*For now, if it is not Analog, it must be digital*/ hpsWnd = WinBeginPaint (hwnd, NULLHANDLE, &rclUpdate); GpiCreateLogColorTable(hpsWnd, 0L, LCOLF_RGB, 0L, 0L, (PLONG) NULL); WinFillRect (hpsWnd, &rclUpdate, cp.clrBackground); memset (achOldTime, 0, sizeof(achOldTime)); memset (achOldAmPm, '0', sizeof(achOldAmPm)); memset (achOldDate, '0', sizeof(achOldDate)); DrawDigitalTime (hwnd); WinEndPaint (hpsWnd); } }
VOID WgtPaint( HWND hwnd, PXCENTERWIDGET pWidget ) { ULONG cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON ) / 2; ULONG cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON ) / 2; HPS hps = WinBeginPaint( hwnd, NULLHANDLE, NULL ); if( hps ) { RECTL rclWin; int x, y; // Get windows size WinQueryWindowRect( hwnd, &rclWin ); // Fill background WinFillRect( hps, &rclWin, CLR_PALEGRAY ); // Center icon in window y = rclWin.yTop - rclWin.yBottom; x = rclWin.xRight - rclWin.xLeft; y = ( y - cy_icon ) / 2; x = ( x - cx_icon ) / 2; // Draw icon in window WinDrawPointer( hps, x, y, ico_tasks, DP_MINI ); WinEndPaint( hps ); } }
/****************************************************************\ * Main client painting routine *-------------------------------------------------------------- * * Name: MainPaint(hwnd) * * Purpose: Paints the main client window. * * Usage: Routine is called whenver the client window * procedure receives a WM_PAINT message * * Method: * - begins painting by calling WinBeginPaint * and retrieving the HPS for the window * - performs any painting desired * - ends painting by calling WinEndPaint * * Returns: * \****************************************************************/ VOID MainPaint(HWND hwnd, /* handle to window */ CHAR PipeMsgs[MAX_MESSAGES][MESSAGE_LEN], /* array of messages */ unsigned int uiIndex, /* beginning of circular array */ SHORT sTotalMsgs) /* total number of messages */ { RECTL rclInvalid; HPS hps; LONG sPaintBeg, sPaintEnd, sLine; POINTL ptl; unsigned int uiOffset; uiOffset = (sTotalMsgs < MAX_MESSAGES) ? 0 : uiIndex; hps = WinBeginPaint(hwnd, NULLHANDLE, (PRECTL)&rclInvalid); GpiErase(hps); sPaintBeg = max(0, sVscrollPos + (cyClient - rclInvalid.yTop) / cyChar); sPaintEnd = min(sTotalMsgs, sVscrollPos + (cyClient - rclInvalid.yBottom) / cyChar + 1); for (sLine = sPaintBeg ; sLine < sPaintEnd ; sLine++) { ptl.x = cxCaps - sHscrollPos ; ptl.y = cyClient - cyChar * (BUFF_OFFSET(uiOffset,sLine) + 1 - sVscrollPos) + cyDesc ; GpiCharStringAt (hps, &ptl, (LONG) strlen (PipeMsgs[BUFF_OFFSET(uiOffset,sLine)]), PipeMsgs[BUFF_OFFSET(uiOffset,sLine)]) ; } WinEndPaint (hps) ; } /* MainPaint() */
static void erase(HWND hwnd, HPS hps, PRECTL rcl) { POINTL p; ICQFRAME *cfg = WinQueryWindowPtr(hwnd,0); hps = WinBeginPaint(hwnd,NULLHANDLE,rcl); icqskin_loadPallete(hps, 0, cfg->pal); #ifdef SKINNED_GUI if(cfg->bg == NO_IMAGE) { WinFillRect(hps, rcl, ICQCLR_BACKGROUND); } else { p.x = rcl->xLeft; p.y = rcl->yBottom; WinDrawBitmap(hps, cfg->bg, rcl, &p, CLR_WHITE, CLR_BLACK, DBM_NORMAL); } #else WinFillRect(hps, rcl, ICQCLR_BACKGROUND); #endif icqskin_drawContents(hwnd,hps); WinEndPaint(hps); }
static void APIENTRY SoftModeThread( thread_data *thread ) { QMSG qmsg; ULONG rc; RECTL rcl; HPS ps; rc = WinThreadAssocQueue( HabDebugger, thread->hmq ); rc = WinSetHook( HabDebugger, thread->hmq, HK_CALLHOOK, (PFN)CallHookProc, NULLHANDLE ); PSetHmqDebugee( thread->hmq, HwndDummy ); rc = WinSetHook( HabDebugger, NULLHANDLE, HK_SENDMSG, (PFN)PSendMsgHookProc, HookDLL ); while( WinQuerySendMsg( HabDebugger, NULLHANDLE, thread->hmq, &qmsg ) ) { WinReplyMsg( HabDebugger, NULLHANDLE, thread->hmq, (MRESULT)0 ); } while( WinGetMsg( HabDebugger, &qmsg, 0, 0, 0 ) ) { // handle messages for task switch( qmsg.msg ) { case WM_PAINT: // don't do any painting ps = WinBeginPaint( qmsg.hwnd, 0, &rcl ); WinEndPaint( ps ); break; default: // have the default window procedure handle the rest WinDefWindowProc( qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2 ); } } WinReleaseHook( HabDebugger, NULLHANDLE, HK_SENDMSG, (PFN)PSendMsgHookProc, HookDLL ); PSetHmqDebugee( thread->hmq, NULLHANDLE ); WinReleaseHook( HabDebugger, thread->hmq, HK_CALLHOOK, (PFN)CallHookProc, NULLHANDLE ); WinThreadAssocQueue( HabDebugger, NULLHANDLE ); WinPostMsg( HwndDebugger, WM_QUIT, 0, 0 ); // tell debugger we're done }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { HPS hps; RECTL rcl; switch (msg) { case WM_CREATE: return 0; case WM_PAINT: hps=WinBeginPaint(hwnd, NULLHANDLE, NULL); WinQueryWindowRect(hwnd, &rcl); GpiErase(hps); WinFillRect(hps, &rcl, CLR_BLUE); PaintClient(hps, 100, 100); WinEndPaint(hps); return 0; case WM_DESTROY: return 0; } return WinDefWindowProc(hwnd, msg, mp1, mp2); }
/**************************************************************************** SysMenu Dialog Procedure *****************************************************************************/ MRESULT EXPENTRY SysMenuProc (HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) { BOOL Handled = TRUE; MRESULT mReturn = 0; RECTL Rectl; POINTL Pointl; ULONG temp; HPS hps; HBITMAP hbm; switch (msg) { case WM_PAINT: hps = WinBeginPaint(hWnd, 0, 0); WinQueryWindowRect(hWnd,&Rectl); WinFillRect(hps, &Rectl, CLR_BLACK); hbm = PointerInfo.hbmMiniColor; WinInflateRect(hab, &Rectl, -1L, -1L); WinDrawBitmap(hps, hbm, NULL, (PPOINTL)&Rectl, 0L, 0L, DBM_NORMAL); WinEndPaint(hps); break; case WM_ERASEBACKGROUND: WinFillRect((HPS)LONGFROMMP(mp1),PVOIDFROMMP(mp2),CLR_BLACK); mReturn = MRFROMLONG(1L); break; default: Handled = FALSE; break; } if (!Handled) mReturn = (*SysMenuDefProc)(hWnd, msg, mp1, mp2); return (mReturn); }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static BOOL fFlipFlop ; HPS hps ; RECTL rcl ; switch (msg) { case WM_TIMER: WinAlarm (HWND_DESKTOP, WA_NOTE) ; fFlipFlop = !fFlipFlop ; WinInvalidateRect (hwnd, NULL, FALSE) ; return 0 ; case WM_PAINT: hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ; WinQueryWindowRect (hwnd, &rcl) ; WinFillRect (hps, &rcl, fFlipFlop ? CLR_BLUE : CLR_RED) ; WinEndPaint (hps) ; return 0 ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static HBITMAP hbm ; HPS hps ; RECTL rcl ; switch (msg) { case WM_CREATE: hps = WinGetPS (hwnd) ; hbm = GpiLoadBitmap (hps, 0, IDB_HELLO, 0L, 0L) ; WinReleasePS (hps) ; return 0 ; case WM_PAINT: hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ; GpiErase (hps) ; WinQueryWindowRect (hwnd, &rcl) ; if (hbm) WinDrawBitmap (hps, hbm, NULL, (PPOINTL) &rcl, CLR_BACKGROUND, CLR_NEUTRAL, DBM_STRETCH) ; WinEndPaint (hps) ; return 0 ; case WM_DESTROY: if (hbm) GpiDeleteBitmap (hbm) ; return 0 ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
MRESULT EXPENTRY ClientWndProc (HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) { HPS hps; BOOL bHandled = TRUE; MRESULT mReturn = 0; switch (msg) { case WM_PAINT: hps = WinBeginPaint (hWnd,0,0); WinEndPaint (hps); break; case WM_ERASEBACKGROUND: mReturn = MRFROMLONG(1L); break; case WM_COMMAND: switch (LOUSHORT(mp1)) { case IDM_ABOUT: DisplayAbout (hWnd, szTitle); break; } default: bHandled = FALSE; break; } if (!bHandled) mReturn = WinDefWindowProc (hWnd,msg,mp1,mp2); return (mReturn); }
MRESULT mainwmPaint(HWND hwnd,MPARAM mp1,MPARAM mp2) { HPS hps; RECTL rectlEntire,rectlUpdate; char str[203]; hps=WinBeginPaint(hwnd, NULLHANDLE, &rectlUpdate); #ifdef DEBUG assert(hps!=NULLHANDLE); #endif if (hps==NULLHANDLE) return 0; WinQueryWindowRect(hwnd,&rectlEntire); GpiSetBackMix(hps,BM_OVERPAINT); WinQueryWindowText(hwndHEF1,201,str); // printf("%d\n",strlen(str)); strcat(str," "); HanOut(hps,0,100,str); WinQueryWindowText(hwndHEF2,201,str); strcat(str," "); HanOut(hps,0,80,str); WinEndPaint(hps); return 0L; }
VOID ClientPaint(HWND hwnd) { POINTL pt; HPS hps; RECTL rcl; LONG lLen; LONG lCenter; WinInvalidateRect(hwnd,(PRECTL)NULL,FALSE); hps = WinBeginPaint(hwnd,(HPS)NULL,&rcl ); // if (bShowingProgress) // rcl.yBottom = 60L; WinFillRect(hps,&rcl,CLR_WHITE); lCenter = (INITWIDTH / 2); if (bDebug) { GpiSetBackColor(hps,CLR_WHITE); GpiSetBackMix(hps,BM_OVERPAINT); GpiCreateLogFont(hps,NULL,3,&fattMsgFont); GpiSetColor(hps,CLR_BLACK); GpiSetCharSet(hps,3); pt.x = 10; if (szDebugLineOne[0] != 0) { pt.y = 82L; GpiCharStringAt(hps,&pt,strlen(szDebugLineOne),szDebugLineOne); } if (szDebugLineTwo[0] != 0) { pt.y = 62L; GpiCharStringAt(hps,&pt,strlen(szDebugLineTwo),szDebugLineTwo); } } else { GpiSetColor(hps,CLR_CYAN); GpiSetBackColor(hps,CLR_WHITE); GpiSetBackMix(hps,BM_OVERPAINT); GpiCreateLogFont(hps, NULL, 2, &fattBigFont); GpiSetCharSet(hps,2); pt.x = (lCenter - (10 * stBigCell.cx)); pt.y = 60L; GpiCharStringAt(hps,&pt,21,"OS/tools Installation"); } if (!bShowingProgress) PrintBanners(szBannerOne,szBannerTwo); WinEndPaint(hps); }
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { HPS hps; RECTL rcl; static ULONG i = 1; ULONG ulMem; char szBuf[200]; switch (msg) { case WM_CREATE: /* use smaller text */ WinSetPresParam(hwnd, PP_FONTNAMESIZE, 7, (PVOID)"8.Helv"); /* start the timer (ticks each 0.5 sec.) */ AddFloat(WinQueryWindow(hwnd, QW_PARENT)); WinStartTimer(hab, hwnd, ID_TIMER, 500); break; /* make window always stay on top (if desired) */ case WM_VRNENABLED: if (bFloat) WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); break; case WM_COMMAND: /* why doesn't WM_SYSCOMMAND work? */ if (LOUSHORT(mp1) == IDM_FLOAT) { bFloat = !bFloat; WinCheckMenuItem(hwndSysSubmenu, IDM_FLOAT, bFloat); } break; case WM_TIMER: if (++i > 13) i = 1; WinInvalidateRect(hwnd, NULL, FALSE); return FALSE; case WM_PAINT: hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl); /* necessary to avoid incorrectly repainting window */ WinQueryWindowRect(hwnd, &rcl); /* sprintf(szBuf, " Current use %dK Maximum ever used %dK Errors %d", meminfo->used / 1024, meminfo->maxused / 1024, meminfo->num_err);*/ sprintf(szBuf, " Current use %dB Maximum ever used %dK Errors %d", meminfo->used, meminfo->maxused / 1024, meminfo->num_err); WinDrawText(hps, -1, szBuf, &rcl, CLR_BLACK, CLR_WHITE, DT_CENTER | DT_VCENTER | DT_ERASERECT); WinEndPaint(hps); break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); }
//************************************************************************************************ // Do some paintjob //************************************************************************************************ void mwpPaint(HWND hWnd) { RECTL rect; HPS hPS = NULLHANDLE; hPS = WinBeginPaint(hWnd, NULLHANDLE, &rect); WinFillRect(hPS, &rect, CLR_PALEGRAY); WinEndPaint(hPS); }
void Paint(void) { HPS hps; RECTL rcl; hps = WinBeginPaint(hwndClient,(HPS)0,(PRECTL)&rcl); GpiSetColor(hps,CLR_WHITE); GpiSetBackColor(hps,CLR_BLUE); GpiSetBackMix(hps,BM_OVERPAINT); WinFillRect(hps,&rcl,CLR_WHITE); WinEndPaint(hps); }
void EXPENTRY wmPaint(HWND hwnd) { video_canvas_t c=(video_canvas_t)WinQueryWindowPtr(hwnd,QWL_USER); // Ptr to usr resources HPS hps=WinGetPS(hwnd); // Handle to Presentation Space // next time call cavas_refresh, refresh the whole canvas if (c->init_ready) c->exposure_handler(c->width, c->height); else c->init_ready=TRUE; // First call=canvas initialize ended WinBeginPaint(hwnd, hps, NULL); // Set Region in hps to blit; WinEndPaint (hps); // must be done every time WM_PAINT was sent }
void ClearScreen(void) { HPS hps; RECTL rcl; WinInvalidateRect(hwndClient,(PRECTL)NULL,FALSE); hps = WinBeginPaint(hwndClient,(HPS)0,(PRECTL)&rcl); GpiSetColor(hps,CLR_WHITE); GpiSetBackColor(hps,CLR_BLUE); GpiSetBackMix(hps,BM_OVERPAINT); WinFillRect(hps,&rcl,CLR_WHITE); WinEndPaint(hps); }
/* Dialog-Procedure f�r die AboutBox (OS/2-Standard) */ MRESULT EXPENTRY AboutBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,MPARAM mp2) { HWND TextPos; IString textstr; SHORT i; ULONG ulScrWidth, ulScrHeight; RECTL Rectl; SWP Swp; HPS hps; switch(msg) { case WM_PAINT: hps = WinBeginPaint (hwnd,0,0); WinQueryWindowRect (hwnd, &Rectl); WinFillRect (hps, &Rectl, SYSCLR_DIALOGBACKGROUND); Rectl.yTop -= WinQuerySysValue(HWND_DESKTOP,SV_CYTITLEBAR), WinDrawBorder (hps, &Rectl, WinQuerySysValue(HWND_DESKTOP,SV_CXDLGFRAME), WinQuerySysValue(HWND_DESKTOP,SV_CYDLGFRAME), CLR_DARKGRAY, CLR_WHITE, DB_RAISED); GpiMove (hps, (PPOINTL)&Rectl); Rectl.xRight--; Rectl.yTop--; WinQueryWindowPos (WinWindowFromID (hwnd, IDD_ACOPYRIGHTFRAME), &Swp); Rectl.xLeft = Swp.x-1; Rectl.yBottom = Swp.y-1; Rectl.xRight = Swp.x + Swp.cx + 1; Rectl.yTop = Swp.y + Swp.cy + 1; WinDrawBorder (hps, &Rectl, 1L, 1L, CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED); WinQueryWindowPos (WinWindowFromID (hwnd, IDD_APROGRAMFRAME), &Swp); Rectl.xLeft = Swp.x-1; Rectl.yBottom = Swp.y-1; Rectl.xRight = Swp.x + Swp.cx + 1; Rectl.yTop = Swp.y + Swp.cy + 1; WinDrawBorder (hps, &Rectl, 1L, 1L, CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED); WinEndPaint (hps); break; case WM_COMMAND: /* no matter what the command, close the dialog */ WinDismissDlg(hwnd, TRUE); break; default: return(WinDefDlgProc(hwnd, msg, mp1, mp2)); } return(MPVOID); } /* AboutBoxWndProc() */
MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) { static HWND hwndMenuPopup ; HPS hps ; POINTL ptlMouse ; switch (msg) { case WM_CREATE: hwndMenuPopup = WinLoadMenu (hwnd, NULL, ID_POPUP) ; WinSetWindowPos (hwndMenuPopup, NULL, 0, 0, 0, 0, SWP_SIZE) ; WinSetParent (hwndMenuPopup, HWND_DESKTOP, FALSE) ; return 0 ; case WM_BUTTON2UP: WinQueryPointerPos (HWND_DESKTOP, &ptlMouse) ; ptlMouse.y += WinQuerySysValue (HWND_DESKTOP, SV_CYMENU) ; WinSetWindowPos (hwndMenuPopup, NULL, (SHORT) ptlMouse.x, (SHORT) ptlMouse.y, 0, 0, SWP_MOVE) ; WinSendMsg (hwndMenuPopup, MM_SELECTITEM, MPFROM2SHORT (IDM_POPUP, FALSE), MPFROMSHORT (FALSE)) ; WinSetCapture (HWND_DESKTOP, hwndMenuPopup) ; return 0 ; case WM_COMMAND: switch (COMMANDMSG(&msg)->cmd) { case IDM_ABOUT: WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc, NULL, IDD_ABOUT, NULL) ; return 0 ; } break ; case WM_PAINT: hps = WinBeginPaint (hwnd, NULL, NULL) ; GpiErase (hps) ; WinEndPaint (hps) ; return 0 ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
MRESULT clbPaint(PCLBOX pclb) { HPS hps; if (pclb && NULLHANDLE != (hps = WinBeginPaint(pclb->hwnd, NULLHANDLE, NULL))) { if (!(pclb->fl & (CLBXS_CHECK | CLBXS_NOCAPT))) { ULONG fl = DT_VCENTER | DT_ERASERECT | DT_MNEMONIC; GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); WinDrawText(hps, -1, pclb->psz, &pclb->rclcpt, pclb->lfgnd, pclb->lbkgnd, (pclb->is.enbl? fl: fl | DT_HALFTONE)); } /* endif */ WinEndPaint(hps); } /* endif */ return (MRESULT)FALSE; }
void Window::processPaint() { QMSG Message; while( WinPeekMsg( Application::hab, &Message, hWndClient, WM_PAINT, WM_PAINT, PM_REMOVE ) ) { RECTL rcl; HPS hps = WinBeginPaint( hWndClient, NULLHANDLE, &rcl ); Rect rect( rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom ); Graphics graph( hps ); paint( &rect, &graph ); WinEndPaint( hps ); } }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static INT cxClient, cyClient ; static LONG alJoin [] = { LINEJOIN_BEVEL, LINEJOIN_ROUND, LINEJOIN_MITRE }, alEnd [] = { LINEEND_FLAT, LINEEND_SQUARE, LINEEND_ROUND } ; HPS hps ; INT i ; switch (msg) { case WM_SIZE: cxClient = SHORT1FROMMP (mp2) ; cyClient = SHORT2FROMMP (mp2) ; return 0 ; case WM_PAINT: hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ; GpiErase (hps) ; for (i = 0 ; i < 3 ; i++) { // Draw the geometric line GpiSetLineJoin (hps, alJoin [i]) ; GpiSetLineEnd (hps, alEnd [i]) ; GpiSetLineWidthGeom (hps, cxClient / 20) ; GpiSetColor (hps, CLR_DARKGRAY) ; GpiBeginPath (hps, 1) ; DrawFigure (hps, i, cxClient, cyClient) ; GpiEndPath (hps) ; GpiStrokePath (hps, 1, 0) ; // Draw the cosmetic line GpiSetLineWidth (hps, LINEWIDTH_THICK) ; GpiSetColor (hps, CLR_BLACK) ; DrawFigure (hps, i, cxClient, cyClient) ; } WinEndPaint (hps) ; return 0 ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
/* * This is necessary since the window does not paint itself */ WPI_MRESULT CALLBACK ClientProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 mp1, WPI_PARAM2 mp2 ) { RECTL rect; WPI_PRES pres; switch( msg ) { case WM_PAINT: pres = WinBeginPaint( hwnd, 0L, (PRECTL)&rect ); WinFillRect( pres, (PRECTL)&rect, CLR_BACKGROUND ); WinEndPaint( pres ); break; default: return( _wpi_defwindowproc( hwnd, msg, mp1, mp2 ) ); } return( 0 ); } /* ClientProc */
/*------------------------------------------------------------------------*/ MRESULT EXPENTRY SplashWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) { static HBITMAP hbm; static SWP swp; HPS hps; RECTL rcl; switch(msg) { case WM_CREATE: hps = WinGetPS (hwnd); hbm = GpiLoadBitmap(hps, (HMODULE)0L, IDB_LOGO, (ULONG)0, (ULONG)0); WinReleasePS (hps); WinQueryWindowPos(hwnd, (PSWP)&swp); return (MRESULT)0; case WM_PAINT: hps = WinBeginPaint (hwnd, NULLHANDLE, /* Get a cached PS */ (RECTL *)0); GpiErase (hps); GpiCreateLogColorTable (hps, LCOL_RESET, LCOLF_RGB, 0L, 0L, NULL) ; rcl.xLeft = 0; rcl.yBottom = 0; rcl.xRight = swp.cx; rcl.yTop = swp.cy; if ( hbm ) WinDrawBitmap(hps,hbm, NULL, (PPOINTL) &rcl, CLR_NEUTRAL, CLR_BACKGROUND, DBM_STRETCH ); WinDrawBorder(hps, &rcl,2L,2L,0L, 0L, DB_DEPRESSED); WinEndPaint(hps); return (MRESULT)0; } return( WinDefWindowProc(hwnd, msg, mp1, mp2) ); }
/************************************************************************** * * Name : MainPaint(hwnd) * * Description: Paints the main client window. * * Concepts: Routine is called whenver the client window * procedure receives a WM_PAINT message * * - begins painting by calling WinBeginPaint * and retrieving the HPS for the window * - performs any painting desired * - ends painting by calling WinEndPaint * * API's : WinBeginPaint * WinFillRect * WinEndPaint * * Parameters : hwnd = window handle *************************************************************************/ VOID MainPaint(HWND hwnd) { RECTL rclUpdate; HPS hps; int i,j; hps = WinBeginPaint(hwnd, NULLHANDLE, &rclUpdate); WinFillRect(hps, &rclUpdate, CLR_WHITE); //рисуем поле for(i=0;i<Row;i++)for(j=0;j<Col;j++)Quatro(&hps,i,j); Kpyr(&hps,Runner.yBottom,Runner.xLeft,CLR_RUNNER); for(i=0;i<QSize;i++) { Kpyr(&hps,Hunters[i].yBottom,Hunters[i].xLeft,CLR_HUNTERS); Kpyr(&hps,Balls[i].yBottom, Balls[i].xLeft,CLR_BALLS);} //цыфры CTPOKA(&hps,1); WinEndPaint(hps); } /* End of MainPaint */
static void kstDraw(HWND hwnd, KSTPTR p) { HPS hps ; RECTL rct ; LONG fore, back ; #ifdef DEBUG TRACE("kstDraw %s\n", p->keyName) ; fflush(stdout) ; #endif fore = p->clrFore ; back = p->keyDown ? p->clrDn : p->clrUp ; hps = WinBeginPaint(hwnd, NULLHANDLE, NULL) ; WinQueryWindowRect(hwnd, &rct) ; WinDrawText(hps, strlen(p->keyName), p->keyName, &rct, fore, back, (DT_CENTER | DT_VCENTER | DT_ERASERECT)) ; WinEndPaint(hps) ; }
// disegna il controllo groupbox MRESULT PaintGroupBox(HWND hwnd) { PCTL pgb = stGetData(hwnd); if (pgb) { RECTL rcl = {0, 0, pgb->wr.cx, pgb->wr.cy}; HPS hps = WinBeginPaint(hwnd, NULLHANDLE, NULL); ULONG brd = pgb->fl & 0x7; ULONG frm = brd; GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); // disegna bordo groupbox WinDrawBorder(hps, &rcl, brd, brd, 0, 0, (pgb->fl & CCTL_RAISED? 0x400: 0x800)); // se necessario disegnare anche frame if (pgb->fl & CCTL_FRAME6) { frm = brd * ((pgb->fl & 0x38) >> 3); rcl.xLeft = frm; rcl.yBottom = frm; rcl.xRight -= frm; rcl.yTop -= frm; WinDrawBorder(hps, &rcl, brd, brd, 0, 0, (pgb->fl & CCTL_RAISED? 0x800: 0x400)); } /* endif */ // se il testo Š presente if (pgb->psz) { // cancella background rcl.xLeft = frm; rcl.yBottom = pgb->wr.cy - pgb->cyFont - 2 * frm - 2; rcl.xRight = pgb->wrtxt.cx + 2 * frm + 3; rcl.yTop = pgb->wr.cy - frm; WinFillRect(hps, &rcl, pgb->lbkgnd); // disegna testo rcl.yBottom += 2; WinDrawText(hps, -1, pgb->psz, &rcl, pgb->lfgnd, pgb->lbkgnd, DT_CENTER | DT_TOP | DT_MNEMONIC | DT_EXTERNALLEADING | ((pgb->fl & WS_DISABLED)? DT_HALFTONE: 0)); // disegna bordo inferiore e a destra del testo rcl.yBottom -= 2; GpiSetColor(hps, (pgb->fl & CCTL_RAISED? pgb->lshadow: pgb->lhilite)); GpiMove(hps, (PPOINTL)&rcl); rcl.xLeft = rcl.xRight; rcl.yTop -= 1; GpiPolyLine(hps, 2, (PPOINTL)&rcl); } /* endif */ WinEndPaint(hps); } /* endif */
static void paint(HWND hwnd) { RECTL rcl; SLIDERDATA *cfg = WinQueryWindowPtr(hwnd,0); HPS hps; POINTL p; XBITMAP *btm; ULONG ySize; ULONG rows; if(!(cfg->btm+cfg->current)->masc) selectBitmap(hwnd,BITMAP_NORMAL); btm = cfg->btm+cfg->current; hps = WinBeginPaint(hwnd,NULLHANDLE,&rcl); /* WinFillRect(hps, &rcl, CLR_RED); */ if(cfg->bg) { p.x = p.y = 0; WinDrawBitmap( hps, cfg->bg, 0, &p, SKC_FOREGROUND, SKC_BACKGROUND, DBM_NORMAL); } if(cfg->selVal <= cfg->maxVal && cfg->maxVal > cfg->minVal && cfg->yCursor) { WinQueryWindowRect(hwnd, &rcl); ySize = (rcl.yTop - rcl.yBottom) - cfg->yCursor; rows = cfg->maxVal - cfg->minVal; p.x = 0; p.y = ((rows-cfg->selVal) * ySize) / rows; drawTransparent(hps, &p, btm); } WinEndPaint(hps); }
MRESULT mainwmPaint(HWND hwnd,MPARAM mp1,MPARAM mp2) { HPS hps; RECTL rectlUpdate; //char str[203]; hps=WinBeginPaint(hwnd, NULLHANDLE, &rectlUpdate); #ifdef DEBUG assert(hps!=NULLHANDLE); #endif if (hps==NULLHANDLE) return 0; // WinQueryWindowRect(hwnd,&rectlEntire); // GpiSetBackMix(hps,BM_OVERPAINT); WinEndPaint(hps); return 0L; }
// // Here is a sample subclass function. // MRESULT APIENTRY SubClassFunc( HWND hWnd, ULONG Message, MPARAM wParam, MPARAM lParam) { PluginInstance *This = GetInstance(hWnd); switch(Message) { case WM_REALIZEPALETTE: WinInvalidateRect(hWnd, 0, TRUE); WinUpdateWindow(hWnd); return 0; break; case WM_PAINT: { RECTL rcl; WinQueryWindowRect( This->hWnd, &rcl ); pprintf( szPPR, "Rect (hmf %x) : ( %d, %d ) - ( %d, %d )\n\r", This->hmf, rcl.xLeft, rcl.yBottom, rcl.xRight, rcl.yTop ); WinInvalidateRect(hWnd, 0, TRUE); RECTL invalidRect; WinBeginPaint( hWnd, This->hps, &invalidRect ); /* draw using common drawing routine */ Draw( This, This->hps, FALSE, TRUE ); WinEndPaint( This->hps ); return (MRESULT)0; } break; default: break; } return ((PFNWP)This->lpfnOldWndProc)( hWnd, Message, wParam, lParam ); }