/**************************************************************************** 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); }
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); }
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); } }
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) ; }
VOID ShowStatusLine( const HPS hps, const char Moves, const char Ships, const LONG Width, const LONG Height ) { RECTL Rect = { 0, Height, Width, Height + 30 }; POINTL Point = { Width, Height }; CHAR text[256]; WinFillRect( hps, &Rect, CLR_WHITE ); //SYSCLR_WINDOW ); // clear background GpiSetColor( hps, CLR_BLACK ); GpiSetLineType( hps, LINETYPE_SHORTDASH ); GpiSetLineWidth( hps, LINEWIDTH_NORMAL ); GpiSetMix( hps, FM_OVERPAINT ); GpiMove( hps, &Point ); Point.x = 0; GpiLine( hps, &Point ); Point.x += 10; Point.y += 10; GpiMove( hps, &Point ); if( Ships ) sprintf( text, "%d %s made %d %s still lost", Moves, Moves == 1 ? "move" : "moves", Ships, Ships == 1 ? "ship" : "ships" ); else sprintf( text, "%d %s made All ships found", Moves, Moves == 1 ? "move" : "moves" ); GpiCharString( hps, strlen(text), text ); DosSleep( 1 ); // free time slice }
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 ); } }
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); }
/************************************************************************** * * Name : DlgQuatro(*HPS phps,int i, int j, LONG lColor) * * Description: рисует квадратик в любом месте любого цвета * * Concepts: Родной брат обычного квадратика. Необходимость * в нем возникла при разработке диалога. Старый не * подходил, и переделывать его значило бы * перелопачивать всю программу. Елки-палки. * * Parameters : phps - указатель на hps * i,j - координаты * lColor - цвет *************************************************************************/ VOID DlgQuatro(PHPS phps,int i, int j, LONG lColor) { RECTL rec;//где рисовать POINTL ptl;//куда и откуда рисовать //рисуем квадрат rec.xLeft = j+1; rec.xRight = j+bs; rec.yBottom = i; rec.yTop = i+bs-1; WinFillRect(*phps, &rec, lColor); if(st){//рисуем линии 3D if(lColor>6) GpiSetColor(*phps,CLR_DARKGRAY); else GpiSetColor(*phps,lColor+8); ptl.x=j; ptl.y=i; GpiMove(*phps,&ptl); ptl.x=j+bs-1; GpiLine(*phps,&ptl); GpiMove(*phps,&ptl); ptl.y=i+bs; GpiLine(*phps,&ptl); ptl.x=j+bs-2; ptl.y=i+bs-1; GpiMove(*phps,&ptl); ptl.y=i+1; GpiLine(*phps,&ptl); GpiMove(*phps,&ptl); ptl.x=j+1; GpiLine(*phps,&ptl);} } /* End of DlgQuatro */
/* * paintColors - paint the available colors on the color palette */ static void paintColors( HWND hwnd ) { WPI_PRES pres; WPI_PRES mempres; HDC hdc; PAINTSTRUCT ps; HBITMAP bitmap; HBITMAP oldbitmap; pres = _wpi_beginpaint( hwnd, NULL, &ps ); #ifdef __OS2_PM__ WinFillRect( pres, &ps, CLR_PALEGRAY ); #endif _wpi_torgbmode( pres ); if( numberOfColors == 2 ) { bitmap = hMonoBitmap; } else { bitmap = hColorBitmap; } mempres = _wpi_createcompatiblepres( pres, Instance, &hdc ); _wpi_torgbmode( mempres ); oldbitmap = _wpi_selectbitmap( mempres, bitmap ); _wpi_bitblt( pres, 0, 0, CUR_BMP_WIDTH, CUR_BMP_HEIGHT, mempres, 0, 0, SRCCOPY ); _wpi_getoldbitmap( mempres, oldbitmap ); _wpi_deletecompatiblepres( mempres, hdc ); _wpi_endpaint( hwnd, pres, &ps ); } /* paintColors */
Boolean QFController::drawBackground(IDrawItemEvent &event) { RECTL rectl = event.itemRect().asRECTL(); WinFillRect((HPS)event.itemPresSpaceHandle(), &rectl, CLR_PALEGRAY); if (detent) { RECTL detentRectl = rectl; detentRectl.xLeft = slider->tickPosition(0).x() + slider->detentPosition(detent); detentRectl.xRight = detentRectl.xLeft + 1; detentRectl.yBottom = detentRectl.yTop - 4; WinFillRect((HPS)event.itemPresSpaceHandle(), &detentRectl, CLR_BLACK); } return true; }
VOID DrawClock (HPS hpsDraw) { RECTL rcl; WinQueryWindowRect (hwndClient, &rcl); WinFillRect (hpsBuffer, &rcl, cp.clrBackground); /* draw the face, the hour hand, and the minute hand */ ClkDrawRing (hpsDraw); ClkDrawFace (hpsDraw); ClkDrawDate (hpsDraw, DM_REDRAW); ClkDrawHand (hpsDraw, HT_HOUR_SHADE, dt.hours); ClkDrawHand (hpsDraw, HT_MINUTE_SHADE, dt.minutes); ClkDrawHand (hpsDraw, HT_HOUR, dt.hours); ClkDrawHand (hpsDraw, HT_MINUTE, dt.minutes); /* draw the tick marks */ if ((cp.usMajorTickPref == CLKTM_ALWAYS) || ((cp.usMajorTickPref == CLKTM_NOTICONIC) && ! fIconic)) ClkDrawTicks (hpsDraw, CLK_MAJORTICKS); if ((cp.usMinorTickPref == CLKTM_ALWAYS) || ((cp.usMinorTickPref == CLKTM_NOTICONIC) && !fIconic)) ClkDrawTicks (hpsDraw, CLK_MINORTICKS); }
/************************************************************************** * * Name : Quatro(*HPS phps,int i, int j) * * Description: рисует квадратик * * Concepts: Получает указатель на пространство отображения * и рисует квадрат размером BmpSize с координатами * i и j * * * API's : * * Parameters : phps - указатель на hps * i,j - номера элемента матрицы Field *************************************************************************/ VOID Quatro(PHPS phps,int i, int j) { RECTL rec;//где рисовать POINTL ptl;//куда и откуда рисовать //рисуем квадрат if(Field == NULL) return;//если инициализации не было rec.xLeft = j*BmpSize+1; rec.xRight = j*BmpSize+BmpSize; rec.yBottom = i*BmpSize; rec.yTop = i*BmpSize+BmpSize-1; WinFillRect(*phps, &rec, Field[i][j]); if(bStyle){//рисуем линии 3D if(Field[i][j]>6) GpiSetColor(*phps,CLR_DARKGRAY); else GpiSetColor(*phps,Field[i][j]+8); ptl.x=j*BmpSize; ptl.y=i*BmpSize; GpiMove(*phps,&ptl); ptl.x=j*BmpSize+BmpSize-1; GpiLine(*phps,&ptl); GpiMove(*phps,&ptl); ptl.y=i*BmpSize+BmpSize; GpiLine(*phps,&ptl); ptl.x=j*BmpSize+BmpSize-2; ptl.y=i*BmpSize+BmpSize-1; GpiMove(*phps,&ptl); ptl.y=i*BmpSize+1; GpiLine(*phps,&ptl); GpiMove(*phps,&ptl); ptl.x=j*BmpSize+1; GpiLine(*phps,&ptl);} } /* End of Quatro */
/* * paintPalette - repaint the color palette */ static void paintPalette( HWND hwnd ) { WPI_PRES hdc; WPI_POINT pt; HPEN holdpen; HPEN hgraypen; HPEN hwhitepen; PAINTSTRUCT rect; WPI_RECT client; int height; hdc = _wpi_beginpaint( hwnd, NULL, &rect ); #ifdef __OS2_PM__ WinFillRect( hdc, &rect, CLR_PALEGRAY ); #endif _wpi_torgbmode( hdc ); GetClientRect( hwnd, &client ); height = _wpi_getheightrect( client ); #if defined( __NT__ ) FillRect( (HDC)hdc, (CONST RECT*)&client, hbrush ); #endif #if defined( __NT__ ) hgraypen = _wpi_createpen( PS_SOLID, 0, GetSysColor( COLOR_BTNSHADOW ) ); #else hgraypen = _wpi_createpen( PS_SOLID, 0, DKGRAY ); #endif holdpen = _wpi_selectobject( hdc, hgraypen ); pt.x = 2; pt.y = 50; _wpi_cvth_pt( &pt, height ); _wpi_movetoex( hdc, &pt, NULL ); pt.y = 6; _wpi_cvth_pt( &pt, height ); _wpi_lineto( hdc, &pt ); pt.x = 90; _wpi_lineto( hdc, &pt ); _wpi_selectobject( hdc, holdpen ); _wpi_deleteobject( hgraypen ); #if defined( __NT__ ) hwhitepen = _wpi_createpen( PS_SOLID, 0, GetSysColor( COLOR_BTNHIGHLIGHT ) ); #else hwhitepen = _wpi_createpen( PS_SOLID, 0, WHITE ); #endif holdpen = _wpi_selectobject( hdc, hwhitepen ); pt.y = 50; _wpi_cvth_pt( &pt, height ); _wpi_lineto( hdc, &pt ); pt.x = 2; _wpi_lineto( hdc, &pt ); _wpi_selectobject( hdc, holdpen ); _wpi_deleteobject( hwhitepen ); _wpi_endpaint( hwnd, hdc, &rect ); } /* paintPalette */
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 drawSlider(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, USHORT id) { POWNERITEM poi; RECTL rcl; POINTL ptl= {0}; poi=(POWNERITEM)PVOIDFROMMP(mp2); switch(poi->idItem) { case SDA_SLIDERARM: WinFillRect(poi->hps,&poi->rclItem, CLR_RED); WinDrawBorder(poi->hps,&poi->rclItem, 2, 2, 0, 0 ,0x0400); return (MRESULT) TRUE; break; case SDA_BACKGROUND: { HPS hps; WinFillRect(poi->hps,&poi->rclItem, CLR_WHITE); return (MRESULT) TRUE; } case SDA_SLIDERSHAFT: { HPS hps; RECTL rcl; MRESULT mr; WinFillRect(poi->hps,&poi->rclItem, CLR_BLUE); return (MRESULT)TRUE; } default: return (MRESULT)TRUE; } /* Done */ return (MRESULT)TRUE; }
Boolean QFController::drawShaft(IDrawItemEvent &event) { if (slider->armPixelOffset() >= slider->armRange() - 1) return true; RECTL emptyRectl = event.itemRect().asRECTL(); RECTL fullRectl = emptyRectl; LONG shaftWidth = slider->shaftSize().width() - 6; LONG firstEmptyPixel = emptyRectl.xRight - shaftWidth + 1 + fullPercent_p * shaftWidth; if (firstEmptyPixel >= emptyRectl.xLeft) { fullRectl.xRight = emptyRectl.xLeft = firstEmptyPixel; WinFillRect((HPS)event.itemPresSpaceHandle(), &fullRectl, CLR_DARKBLUE); } WinFillRect((HPS)event.itemPresSpaceHandle(), &emptyRectl, CLR_PALEGRAY); return true; }
//************************************************************************************************ // Do some paintjob //************************************************************************************************ void mwpPaint(HWND hWnd) { RECTL rect; HPS hPS = NULLHANDLE; hPS = WinBeginPaint(hWnd, NULLHANDLE, &rect); WinFillRect(hPS, &rect, CLR_PALEGRAY); WinEndPaint(hPS); }
static HPS hpsDrawText(HPS hPS, PTEXTFIELD ptf) { FONTMETRICS fm3D; /* Font Metrics Holder */ RECTL rcl; /* Rectangle Holder */ register LONG i, k, n; /* String Length Counter */ /* Get the presentation space for the control */ /* and set the colour table to RGB mode */ GpiCreateLogColorTable(hPS, 0L, LCOLF_RGB, 0L, 0L, (PLONG)NULL); /* Check to see if any text present and if the */ /* case, draw it within the rectangle */ if ( ptf->cText ) /* Check to see if the text is to be broken over */ /* more than one line if the length of the text */ /* is greater than the width of the control */ if ( ptf->flStyle & DT_WORDBREAK ) { /* Word break style specified, set the drawing */ /* of the text within a loop such that it can */ /* be drawn on successive lines */ n = ptf->cText; GpiQueryFontMetrics(hPS, sizeof(FONTMETRICS), &fm3D); rcl = ptf->rcl; i = 0; do { n -= (k = WinDrawText(hPS, n, &ptf->pszText[i], &rcl, ptf->lClrText, ptf->lClrBackground, ptf->flFormat)); i += k; if ( (rcl.yTop -= fm3D.lMaxBaselineExt) < rcl.yBottom ) break; } while ( n > 0 ); } else WinDrawText(hPS, ptf->cText, ptf->pszText, &ptf->rcl, ptf->lClrText, ptf->lClrBackground, ptf->flFormat); else WinFillRect(hPS, &ptf->rcl, ptf->lClrBackground); GpiSetColor(hPS, ptf->lClrLeftTop); GpiMove(hPS, &ptf->aptl[3]); GpiPolyLine(hPS, 2L, ptf->aptl); GpiSetColor(hPS, ptf->lClrBottomRight); GpiPolyLine(hPS, 2L, &ptf->aptl[2]); return(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 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); }
// updates the buffer VOID DrawPSBuffer() { RECTL rectl; rectl.xLeft = rectl.yBottom = 0; rectl.xRight = GBoard.GetWinWidth(); rectl.yTop = GBoard.GetWinHeight(); wcprintf("Das Board denkt: Breite: %d H”he: %d", rectl.xRight, rectl.yTop ); WinFillRect( hpsGlob, &rectl, CLR_WHITE ); WinFillRect( hpsBufferGlob, &rectl, CLR_WHITE ); wcprintf("Jetzt wird der Hintergrund gezeichnet"); ShowStatusLine( hpsGlob, GBoard.MovesNeeded(), InfoData.ShipsNotFound, GBoard.GetWinWidth(), GBoard.GetWinHeight() ); ShowStatusLine( hpsBufferGlob, GBoard.MovesNeeded(), InfoData.ShipsNotFound, GBoard.GetWinWidth(), GBoard.GetWinHeight() ); GBoard.DrawPMBoard( hpsGlob ); GBoard.DrawPMBoard( hpsBufferGlob ); }
/* * _ClearWindow - erase a window */ void _ClearWindow( LPWDATA w ) { HWND hwnd; hwnd = w->hwnd; /*** Clear the w->image array ***/ #ifdef _MBCS { mb_char mbc; int count; mbc = _mbsnextc( (unsigned char *)" " ); for( count=0; count < w->width * w->height; count++ ) { w->image[count] = mbc; /* store space in w->image */ } } #else FARmemset( w->image, 0x20, w->width*w->height ); #endif #if defined( __OS2__ ) { HPS ps; RECTL rcl; ps = WinGetPS( hwnd ); WinQueryWindowRect( hwnd, &rcl ); WinFillRect( ps, &rcl, CLR_WHITE ); WinReleasePS( ps ); } #else { RECT rect; HDC dc; dc = GetDC( hwnd ); #ifndef __NT__ UnrealizeObject( w->brush ); #endif SelectObject( dc, w->brush ); #ifdef __NT__ SetBrushOrgEx( dc, 0, 0, NULL ); #endif GetClientRect( hwnd, &rect ); FillRect( dc, &rect, w->brush ); ReleaseDC( hwnd, dc ); } #endif } /* _ClearWindow */
/* 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() */
/*@ XToolBar::Draw(void) @group display @remarks Redraw the toolbar. */ void XToolBar::Draw(void) { RECTL rect; WinQueryWindowRect(winhandle, &rect); HPS hps = WinGetPS(winhandle); GpiCreateLogColorTable(hps, LCOL_RESET, LCOLF_RGB, 0,0,NULL); WinFillRect( hps, &rect, SYSCLR_BUTTONMIDDLE); WinDrawBorder(hps, &rect, 1,1,0,0,DB_PATCOPY|DB_RAISED); HENUM e; HWND hwnd; e = WinBeginEnumWindows(winhandle); while ((hwnd = WinGetNextWindow(e)) != 0) WinInvalidateRegion(hwnd, NULLHANDLE, TRUE); WinEndEnumWindows(e); }
MRESULT DrawMenuItem( POWNERITEM poi ) { TASKDATA* data = (TASKDATA*)poi->hItem; BOOL select = (poi->fsAttribute & MIA_HILITED) ? TRUE : FALSE; ULONG cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON ); ULONG cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON ); POINTL pos; RECTL rect = poi->rclItem; WinFillRect( poi->hps, &rect, select ? SYSCLR_MENUHILITEBGND : SYSCLR_MENU ); rect.xLeft += 2; rect.yBottom += ( rect.yTop - rect.yBottom - cy_icon/2 ) / 2; if( data->hIcon != NULLHANDLE ) { WinDrawPointer( poi->hps, rect.xLeft + 1, rect.yBottom + 1, data->hIcon, DP_MINI ); } rect.xLeft += cx_icon/2 + 5; rect.yBottom = poi->rclItem.yBottom; WinDrawText( poi->hps, -1, data->szTitle, &rect, select ? SYSCLR_MENUHILITE : SYSCLR_MENUTEXT, 0, DT_LEFT | DT_VCENTER ); // Well well well... And now ;) we are going to fix A great-Warp4-Menu-Bug // Make to redraw erased parts of menu's window border // Define something like #ifdef WARP_3 if you are running OS/2 Warp 3.x // vertical "light" line pos.x = poi->rclItem.xLeft; pos.y = 1; GpiSetColor( poi->hps, SYSCLR_BUTTONLIGHT ); GpiMove( poi->hps, &pos ); pos.y = poi->rclItem.yTop; GpiLine( poi->hps, &pos ); // horizontal "dark" line pos.x = 1; pos.y = 1; GpiSetColor( poi->hps, SYSCLR_BUTTONDARK ); GpiMove( poi->hps, &pos ); pos.x = poi->rclItem.xRight; GpiLine( poi->hps, &pos ); poi->fsAttributeOld = (poi->fsAttribute &= ~MIA_HILITED); return MRFROMLONG( TRUE ); }
void ErrorNotify(char szMessage[]) { HPS hps; RECTL rcl; POINTL ptl; ptl.y = 2; ptl.x = stCell.cx; rcl.yBottom = 0; rcl.yTop = stCell.cy; rcl.xLeft = 0; rcl.xRight = ulWindowWidth; hps = WinGetPS(hwndClient); WinFillRect(hps,&rcl,CLR_WHITE); GpiCharStringAt(hps,&ptl,strlen(szMessage),szMessage); WinReleasePS(hps); }
/* * paintScreen - paint the screen and inverse window */ static void paintScreen( HWND hwnd ) { WPI_PRES pres; PAINTSTRUCT ps; pres = _wpi_beginpaint( hwnd, NULL, &ps ); #ifdef __OS2_PM__ WinFillRect( pres, &ps, CLR_PALEGRAY ); #endif _wpi_torgbmode( pres ); if( fShowScreenClr ) { DisplayColorBox( pres, &screenColor ); DisplayColorBox( pres, &inverseColor ); } _wpi_endpaint( hwnd, pres, &ps ); } /* paintScreen */
/************************************************************************** * * 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 */
/* * 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 */
void PrintString(char szMessage[],ULONG ulLine) { HPS hps; RECTL rcl; POINTL ptl; ptl.y = (ulWindowHeight - (ulLine * (stCell.cy + 3))); ptl.x = stCell.cx; rcl.yBottom = (ptl.y - 3); rcl.yTop = (ptl.y + stCell.cy); rcl.xLeft = 0; rcl.xRight = ulWindowWidth; hps = WinGetPS(hwndClient); WinFillRect(hps,&rcl,CLR_WHITE); GpiCharStringAt(hps,&ptl,strlen(szMessage),szMessage); WinReleasePS(hps); }