VCF::Win32Context Class Reference
A Context provides the lowest level graphics interface to the native systems 2D drawing operations. More...
#include <Win32Context.h>
Inheritance diagram for VCF::Win32Context:

Public Member Functions | |
| Win32Context () | |
| Win32Context (const uint32 &width, const uint32 &height) | |
| creates a new HDC from scratch | |
| Win32Context (OSHandleID contextID) | |
| virtual | ~Win32Context () |
| virtual void | setContext (GraphicsContext *context) |
| virtual GraphicsContext * | getContext () |
| virtual OSHandleID | getContextID () |
| virtual void | setContextID (OSHandleID handle) |
| void | init () |
| virtual void | setOrigin (const double &x, const double &y) |
| virtual Point | getOrigin () |
| virtual bool | isAntiAliasingOn () |
| Turns the XOR mode on or off. | |
| virtual void | setAntiAliasingOn (bool antiAliasingOn) |
| virtual bool | prepareForDrawing (int32 drawingOperation) |
| this method is called for the peer to initialize any graphics resources before calling the following methods: | |
| virtual void | finishedDrawing (int32 drawingOperation) |
| virtual bool | isMemoryContext () |
| is this context Peer in memory or does it associated with a component ? | |
| virtual void | copyContext (const Rect &sourceRect, const Rect &destRect, ContextPeer *sourceContext) |
| virtual void | textAt (const Rect &bounds, const String &text, const int32 &drawOptions=0) |
| virtual double | getTextWidth (const String &text) |
| virtual double | getTextHeight (const String &text) |
| virtual void | lineTo (const double &x, const double &y) |
| virtual void | moveTo (const double &x, const double &y) |
| virtual void | closePath () |
| virtual void | rectangle (const double &x1, const double &y1, const double &x2, const double &y2) |
| virtual void | roundRect (const double &x1, const double &y1, const double &x2, const double &y2, const double &xc, const double &yc) |
| virtual void | ellipse (const double &x1, const double &y1, const double &x2, const double &y2) |
| virtual void | arc (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3, const double &x4, const double &y4) |
| virtual void | polyline (const std::vector< Point > &pts) |
| virtual void | curve (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3, const double &x4, const double &y4) |
| virtual void | drawImage (const double &x, const double &y, Rect *imageBounds, Image *image, int compositeMode) |
| virtual void | bitBlit (const double &x, const double &y, Rect *imageBounds, Image *image) |
| "Blits" the image to the underlying graphics context. | |
| void | copyToImage (Win32Image *image) |
| virtual void | checkHandle () |
| make sure we always have the HDC ( device context handle ) we need. | |
| virtual void | releaseHandle () |
| Does the opposite operation of checkHandle(), i.e. | |
| virtual void | setTextAlignment (const bool &alignTobaseline) |
| this is used to determine how to align text when the windowing systems draws it. | |
| virtual bool | isTextAlignedToBaseline () |
| virtual void | setClippingPath (Path *clippingPath) |
| sets the current clipping path to be used for the duration of the Contexts lifetime or until it has been changed | |
| virtual void | setClippingRect (Rect *clipRect) |
| virtual void | drawThemeSelectionRect (Rect *rect, DrawUIState &state) |
| virtual void | drawThemeFocusRect (Rect *rect, DrawUIState &state) |
| Draws a focus rect, which is an inverted gray dotted line around the rect. | |
| virtual void | drawThemeButtonRect (Rect *rect, ButtonState &state, Rect *captionRect=NULL) |
| Draws a button's background, the border, and its caption. | |
| virtual void | drawThemeButtonFocusRect (Rect *rect) |
| Similar to drawThemeFocusRect, but dimension of the focus rect is chosen by the peer. | |
| virtual void | drawThemeCheckboxRect (Rect *rect, ButtonState &state) |
| virtual void | drawThemeRadioButtonRect (Rect *rect, ButtonState &state) |
| virtual void | drawThemeComboboxRect (Rect *rect, ButtonState &state) |
| virtual void | drawThemeScrollButtonRect (Rect *rect, ScrollBarState &state) |
| virtual void | drawThemeDisclosureButton (Rect *rect, DisclosureButtonState &state) |
| Draws a button that is used to open up more details, for example the button that opens up a tree node to reveal it's children, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeTab (Rect *rect, TabState &state) |
| Draws a tab, the part of the TabbedPages control that acts like a little button to activate a page, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeTabPage (Rect *rect, DrawUIState &state) |
| Draws a tab page - the page on which other controls for the page are parented to, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeTabContent (Rect *rect, DrawUIState &state) |
| virtual void | drawThemeTabs (Rect *rect, DrawUIState &paneState, TabState &selectedTabState, TabState &otherTabs, const std::vector< String > &tabNames, int selectedTabIndex) |
| virtual void | drawThemeTickMarks (Rect *rect, SliderState &state) |
| Draws a tick mark, like that used for a slider control, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeSlider (Rect *rect, SliderState &state) |
| Draws a slider control, like that used for a slider control, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeProgress (Rect *rect, ProgressState &state) |
| Draws a progress bar control, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeImage (Rect *rect, Image *image, DrawUIState &state) |
| virtual void | drawThemeHeader (Rect *rect, ButtonState &state) |
| Draws a header control that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeEdge (Rect *rect, DrawUIState &state, const int32 &edgeSides, const int32 &edgeStyle) |
| draws edges, useful for separators, that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeBorder (Rect *rect, DrawUIState &state) |
| virtual void | drawThemeSizeGripper (Rect *rect, DrawUIState &state) |
| Draws a size gripper for resizing a control/window that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeBackground (Rect *rect, BackgroundState &state) |
| Draws a them compliant background. | |
| virtual void | drawThemeMenuItem (Rect *rect, MenuState &state) |
| Draws the background appropriate for a menu item that is compliant with the native windowing systems default look and feel. | |
| virtual void | drawThemeMenuItemText (Rect *rect, MenuState &state) |
| virtual void | drawThemeText (Rect *rect, TextState &state) |
Protected Member Functions | |
| void | drawImageAGG (const double &x, const double &y, Rect *imageBounds, Image *image) |
| void | drawGrayScaleImage (const double &x, const double &y, Rect *imageBounds, Image *image) |
| void | prepareDCWithContextFont (HFONT &fontHandle) |
| HDC | getDC () |
Static Protected Member Functions | |
| static void | drawTransparentBitmap (HDC hdc, HBITMAP hBitmap, int32 xStart, int32 yStart, COLORREF cTransparentColor) |
| Utility function to draw a transparent bitmap. | |
Protected Attributes | |
| HRGN | clipRGN_ |
| bool | pathStarted_ |
| Point | oldOrigin_ |
| Point | origin_ |
| bool | inFillPath_ |
| HDC | dc_ |
| HBITMAP | memBitmap_ |
| HBITMAP | originalBitmap_ |
| HBRUSH | currentHBrush_ |
| HPEN | currentHPen_ |
| HFONT | currentHFont_ |
| int | currentDCState_ |
| bool | isMemoryCtx_ |
| GraphicsContext * | context_ |
| bool | alignToBaseline_ |
Detailed Description
A Context provides the lowest level graphics interface to the native systems 2D drawing operations.Based loosely on PostScript, a Context takes a series of of drawing operations, or commands (lineTo, moveTo, etc), and then executes them by either filling or strokeing the path(s) that result from the commands. Thus calling ellipse() will not draw anything till the strokePath() or fillPath() methods have been called. All path commands should add their information to a stack of some sort that is then looped through and executed using the appropriate native graphics calls. At each path command a test should be made as to whether the buffer should be cleared. The buffer should be cleared only after the stroke of fill methods have been called. For example:
ellipse(23,23,45,67) //added to buffer moveTo(89,100) //add to buffer lineTo(300,40) //add to buffer strokePath() fillPath() rectangle(200,300,400,400)//buffer cleared, then add to buffer
Constructor & Destructor Documentation
|
|
|
|
||||||||||||
|
creates a new HDC from scratch
|
|
|
|
|
|
|
Member Function Documentation
|
||||||||||||||||||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||||||||||
|
"Blits" the image to the underlying graphics context. No attempt is made to transform the image. The image is blitted to the coordinates specified by the x and y arguments, and the image's width and height are used to determine the bounds. Implements VCF::ContextPeer. |
|
|
make sure we always have the HDC ( device context handle ) we need. Normally the paint function already receives the correct handle so this is a no-op (does nothing). In the case of a control we may need to get a different HDC, for example when painting under a mouse move event or getting other informations depending on the device context.
Reimplemented in VCF::Win32ControlContext. |
|
|
Implements VCF::ContextPeer. |
|
||||||||||||||||
|
Implements VCF::ContextPeer. |
|
|
|
|
||||||||||||||||||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||||||||||
|
|
|
||||||||||||
|
Draws a them compliant background.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
|
Similar to drawThemeFocusRect, but dimension of the focus rect is chosen by the peer.
Implements VCF::ContextPeer. |
|
||||||||||||||||
|
Draws a button's background, the border, and its caption.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a button that is used to open up more details, for example the button that opens up a tree node to reveal it's children, that is compliant with the native windowing systems default look and feel. On Win32 this is usually represented by the "+" and "-" look as found on the tree controls, while on OSX it is the little triangles Implements VCF::ContextPeer. |
|
||||||||||||||||||||
|
draws edges, useful for separators, that is compliant with the native windowing systems default look and feel. use a mask or 1 or more values of type ContextPeer::EdgeType to indicate which sides of the rect to draw an edge on Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a focus rect, which is an inverted gray dotted line around the rect.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a header control that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws the background appropriate for a menu item that is compliant with the native windowing systems default look and feel. This is typically called first by a menu item to give it a standard look and feel in it's background before drawing any thing else Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a progress bar control, that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a size gripper for resizing a control/window that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a slider control, like that used for a slider control, that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a tab, the part of the TabbedPages control that acts like a little button to activate a page, that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a tab page - the page on which other controls for the page are parented to, that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Draws a tick mark, like that used for a slider control, that is compliant with the native windowing systems default look and feel.
Implements VCF::ContextPeer. |
|
||||||||||||||||||||||||
|
Utility function to draw a transparent bitmap.
|
|
||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
|
|
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
|
|
|
Turns the XOR mode on or off.
Implements VCF::ContextPeer. |
|
|
is this context Peer in memory or does it associated with a component ?
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
||||||||||||
|
Implements VCF::ContextPeer. |
|
|
Implements VCF::ContextPeer. |
|
|
|
|
|
this method is called for the peer to initialize any graphics resources before calling the following methods:
Implements VCF::ContextPeer. |
|
||||||||||||||||||||
|
Implements VCF::ContextPeer. |
|
|
Does the opposite operation of checkHandle(), i.e. restores the previous HDC if it has been changed by checkHandle(). Normally the paint function already receives the correct handle in checkHandle() so this one too is a no-op.
Reimplemented in VCF::Win32ControlContext. |
|
