#include <ccdc.h>
Inheritance diagram for CCDC:
Public Member Functions | |
CCDC (RenderType=RENDERTYPE_NONE) | |
Constructor for CCDC. Stores type and zeros rectangle list. | |
CCDC (CNativeDC *, RenderType=RENDERTYPE_NONE) | |
Constructor for CCDC to base it on an existing CDC. The CDC on which this is based MUST stay in existance while this CCDC is in existence as it 'borrows' the members from the doner CDC. | |
~CCDC () | |
Destructor for CCDC. | |
CNativeDC * | GetDC () const |
operator CNativeDC & () | |
void | SetDC (CNativeDC *dc, BOOL bDeleteDC=TRUE) |
RenderType | GetRenderType () const |
virtual BOOL | IsPrinting () const |
Static Public Member Functions | |
static UINT32 | GetRectangleList (wxDC *, wxRect **) |
The whole point of CCDCs over normal CDCs is to get additional information. This call allows access to the clipping rectangle list. A zero return is not an error, it just means that the rectangle list is not known. | |
static RenderType | GetType (CNativeDC *, BOOL) |
Get an indication of the type of the render destination. | |
static BOOL | IsPaperWanted (RenderType) |
Used by the document renderer to decide whether paper-like things should be drawn. | |
static BOOL | CleanUpDCs (void) |
static CCDC * | ConvertFromNativeDC (CNativeDC *pDC) |
See if a CDC* is really a CCDC* which we can get useful extra information from. | |
Protected Attributes | |
RenderType | Type |
LPRGNDATA | lpRgnData |
CNativeDC * | m_pDC |
BOOL | m_bDeleteDC |
Static Protected Attributes | |
static List | s_DCList |
A layer above the MFC CDC class which contains additional information, including a type word (see RenderType) and rectangle list information. Note that is is derived from an MFC class, not CCObject so take care with 'new's and ISRUNTIME checks. |
Definition at line 108 of file ccdc.h.
|
Constructor for CCDC. Stores type and zeros rectangle list.
Definition at line 163 of file ccdc.cpp. 00164 { 00165 lpRgnData = NULL; 00166 Type = rType; 00167 m_pDC = NULL; 00168 m_bDeleteDC = TRUE; 00169 }
|
|
Constructor for CCDC to base it on an existing CDC. The CDC on which this is based MUST stay in existance while this CCDC is in existence as it 'borrows' the members from the doner CDC.
Definition at line 188 of file ccdc.cpp. 00189 { 00190 lpRgnData = NULL; 00191 Type = rType; 00192 m_pDC=NULL; 00193 m_bDeleteDC = FALSE; 00194 SetDC(pDC, FALSE); // previously m_pDC = pDC; 00195 }
|
|
Destructor for CCDC.
Definition at line 212 of file ccdc.cpp. 00213 { 00214 SetDC(NULL); 00215 CCFree(lpRgnData); 00216 lpRgnData = NULL; 00217 00218 // Karim 06/06/2000 - NULLify our handles. 00219 // m_hDC = NULL; 00220 // m_hAttribDC = NULL; 00221 }
|
|
Definition at line 447 of file ccdc.cpp. 00448 { 00449 // Delete all the entries in the list (the item destructors will delete the DCs) 00450 s_DCList.DeleteAll(); 00451 00452 return(TRUE); 00453 }
|
|
See if a CDC* is really a CCDC* which we can get useful extra information from.
Definition at line 239 of file ccdc.cpp. 00240 { 00241 if (!pDC) 00242 return NULL; 00243 00244 // Scan the DCList to find the item 00245 CCDC * pItem = (CCDC*)s_DCList.GetHead(); 00246 while (pItem) 00247 { 00248 if (pItem->GetDC() == pDC) 00249 return pItem; 00250 00251 pItem = (CCDC*)s_DCList.GetNext(pItem); 00252 } 00253 00254 return NULL; 00255 }
|
|
Definition at line 124 of file ccdc.h. 00124 { return(m_pDC); }
|
|
The whole point of CCDCs over normal CDCs is to get additional information. This call allows access to the clipping rectangle list. A zero return is not an error, it just means that the rectangle list is not known.
Definition at line 275 of file ccdc.cpp. 00276 { 00277 const CCDC *pCCDC = ConvertFromNativeDC(pCDC); 00278 00279 if (pCCDC == NULL) 00280 return 0; // if not a CCDC 00281 00282 #ifndef EXCLUDE_FROM_XARALX 00283 // Multi-region draw hints are only supported on MSW 00284 #if defined( __WXMSW__ ) 00285 if (pCCDC->lpRgnData && (pCCDC->lpRgnData->rdh.iType == RDH_RECTANGLES) ) 00286 { 00287 *lpRect = (wxRect *)( &pCCDC->lpRgnData->Buffer ); // the address of the rectangle list 00288 return (UINT32)(pCCDC->lpRgnData->rdh.nCount); 00289 } 00290 #endif 00291 #endif 00292 return 0; 00293 }
|
|
Definition at line 127 of file ccdc.h. 00127 { return Type; }
|
|
Get an indication of the type of the render destination.
Definition at line 313 of file ccdc.cpp. 00314 { 00315 const CCDC *pCCDC = ConvertFromNativeDC( pDC ); 00316 00317 if (pCCDC == NULL) 00318 { 00319 PORTNOTETRACE("other","CCDC::GetType - can't calculate device type yet"); 00320 #ifndef EXCLUDE_FROM_XARALX 00321 if (bCalculate) 00322 { 00323 // work out the type from the HDC if he can. We don't use the MFC fn as 00324 // it gets the type from the attrib, not the actual HDC, though this screws 00325 // up with Print Preview 00326 switch ( ::GetDeviceCaps( pDC->m_hDC, TECHNOLOGY ) ) 00327 { 00328 case DT_RASDISPLAY: 00329 return RENDERTYPE_SCREEN; 00330 00331 case DT_PLOTTER: 00332 case DT_RASPRINTER: 00333 // Need to detect if this is a PostScript printer - this requires 00334 // different code on different OSs. 00335 // (This code taken from MSDN - PSS ID Number: Q124135) 00336 WORD wEscape; 00337 00338 if (IsWin32NT() || IsWin32c()) 00339 { 00340 wEscape = POSTSCRIPT_PASSTHROUGH; // Fails with Win16 driver 00341 if (pDC->Escape(QUERYESCSUPPORT, sizeof(WORD), (LPCSTR) &wEscape, NULL) > 0) 00342 { 00343 // Found a PS printer 00344 return RENDERTYPE_PRINTER_PS; 00345 } 00346 } 00347 else if (IsWin32s()) 00348 { 00349 // use printer escape to determine printer type. 00350 wEscape = GETTECHNOLOGY; 00351 if (pDC->Escape(QUERYESCSUPPORT, sizeof(WORD), (LPCSTR) &wEscape, NULL) > 0) 00352 { 00353 // Supports Escapes - get the technology info. 00354 char Technology[256]; 00355 pDC->Escape(GETTECHNOLOGY, 0, NULL, 255, Technology); 00356 00357 // Does the technology description start with "postscript"? 00358 if (_tcsncicmp(Technology, "postscript", 10) == 0) 00359 { 00360 // Ok - does it support passthrough? 00361 wEscape = PASSTHROUGH; 00362 if (pDC->Escape(QUERYESCSUPPORT, sizeof(WORD), 00363 (LPCSTR) &wEscape, NULL) > 0) 00364 { 00365 // Found a PS printer 00366 return RENDERTYPE_PRINTER_PS; 00367 } 00368 } 00369 00370 // GETTECHNOLOGY might not work on some printer drivers, so 00371 // try another escape - EPSPRINTING - should only work on PS! 00372 wEscape = EPSPRINTING; 00373 if (pDC->Escape(QUERYESCSUPPORT, sizeof(WORD), (LPCSTR) &wEscape, NULL) > 0) 00374 { 00375 // Supports EPS printing - must be PostScript. 00376 return RENDERTYPE_PRINTER_PS; 00377 } 00378 } 00379 } 00380 00381 // If we've got here its a normal (non-PS) printer. 00382 return RENDERTYPE_PRINTER; 00383 00384 case DT_METAFILE: 00385 return RENDERTYPE_METAFILE16; // 32-bit metafiles return their 00386 // context device, which we 00387 // cannot create anyway as yet 00388 } 00389 } 00390 #endif 00391 00392 return RENDERTYPE_NONE; 00393 } 00394 00395 // its an actual CCDC so its type is well-known 00396 return pCCDC->Type; 00397 }
|
|
Used by the document renderer to decide whether paper-like things should be drawn.
Definition at line 416 of file ccdc.cpp. 00417 { 00418 switch (rType) 00419 { 00420 case RENDERTYPE_SCREEN: 00421 case RENDERTYPE_SCREENXOR: 00422 return TRUE; 00423 00424 case RENDERTYPE_PRINTER: 00425 return FALSE; 00426 00427 case RENDERTYPE_MONOBITMAP: 00428 return FALSE; 00429 00430 case RENDERTYPE_HITDETECT: 00431 return FALSE; 00432 00433 case RENDERTYPE_COLOURBITMAP: 00434 return TRUE; 00435 00436 case RENDERTYPE_METAFILE16: 00437 case RENDERTYPE_METAFILE32: 00438 return FALSE; 00439 00440 default: 00441 TRACE( _T("Bad rendertype %d in IsPaperWanted\n"), rType ); 00442 return TRUE; 00443 } 00444 }
|
|
Definition at line 129 of file ccdc.h. 00129 { return (Type == RENDERTYPE_PRINTER) || (Type == RENDERTYPE_PRINTER_PS); }
|
|
Definition at line 125 of file ccdc.h. 00125 { return (*m_pDC); }
|
|
Definition at line 456 of file ccdc.cpp. 00457 { 00458 if (m_pDC == dc) 00459 return; 00460 00461 if (m_pDC) 00462 { 00463 if (m_bDeleteDC) 00464 delete (m_pDC); 00465 // take us off the list 00466 s_DCList.RemoveItem(this); 00467 } 00468 m_pDC = dc; 00469 if (m_pDC) 00470 { 00471 m_bDeleteDC = bDeleteDC; 00472 // put us on the list 00473 s_DCList.AddTail(this); 00474 } 00475 }
|
|
|
|
|
|
|
|
A layer above the MFC CDC class which contains additional information, including a type word (see RenderType) and rectangle list information. Note that is is derived from an MFC class, not CCObject so take care with 'new's and ISRUNTIME checks.
|
|
|