CBitmapGridDropDown Class Reference

#include <bitmapgriddropdown.h>

Inheritance diagram for CBitmapGridDropDown:

CGridDropDown ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 CBitmapGridDropDown ()
virtual ~CBitmapGridDropDown ()
void AddItem (UINT32 uiBitmapResID, String_256 strLabel=String_256(), BOOL bStretch=TRUE)
void AddItem (wxBitmap *pBitmap, BOOL bDelete=TRUE, String_256 strLabel=String_256(), BOOL bStretch=TRUE)
void AddItem (KernelBitmap *pBitmap, BOOL bDelete=TRUE, String_256 strLabel=String_256(), BOOL bStretch=TRUE)
void AddItem (LineAttrItem *plaiStroke, BOOL bDelete=TRUE, String_256 strLabel=String_256())
void AddItem (AttrBrushType *pabtBrush, BOOL bDelete=TRUE, String_256 strLabel=String_256())
void SetUnselectedItem (UINT32 uiBitmapResID, String_256 strLabel=String_256())
void SetUnselectedItem (wxBitmap *pBitmap, String_256 strLabel=String_256())
void SelectByLabel (String_256 strLabel)

Protected Member Functions

CBGDDItemInfoGetItemData (INT32 iItem)
virtual void DrawItemCore (wxDC &dc, const wxRect &rect, INT32 iItem, INT32 iFlags)
wxBitmap * PreviewBrush (AttrBrushType *pabtBrush)
KernelBitmapPreviewStroke (LineAttrItem *plaiStroke)

Protected Attributes

CBGDDItemInfom_poUnselectedItem

Friends

class DialogManager

Detailed Description

Class : CBitmapGridDropDown Base Class : public CGridDropDown Author : Mikhail Tatarnikov Description : Control class for wxGridCombo control that stores and displays items as images. Pure Virtual : None Known Issues : None Usage Notes : None Override Notes: None

Definition at line 328 of file bitmapgriddropdown.h.


Constructor & Destructor Documentation

CBitmapGridDropDown::CBitmapGridDropDown  ) 
 

Definition at line 581 of file bitmapgriddropdown.cpp.

00582 {
00583     m_poUnselectedItem  = NULL;
00584 }

CBitmapGridDropDown::~CBitmapGridDropDown  )  [virtual]
 

Definition at line 588 of file bitmapgriddropdown.cpp.

00589 {
00590 }


Member Function Documentation

void CBitmapGridDropDown::AddItem AttrBrushType pabtBrush,
BOOL  bDelete = TRUE,
String_256  strLabel = String_256()
 

Function : CBitmapGridDropDown::AddItem Author : Mikhail Tatarnikov Purpose : Adds an item and display a brush in it. Returns : void Exceptions: Parameters: [in] AttrBrushType* pabtBrush - the brush to be previewed in the item; [in] String_256 strLabel - the item label. Notes :

Definition at line 669 of file bitmapgriddropdown.cpp.

00670 {
00671     CBGDDBrushItem* pBrushItem = new CBGDDBrushItem(pabtBrush, bDelete, strLabel);
00672     CGridDropDown::AddItem(pBrushItem);
00673 }

void CBitmapGridDropDown::AddItem LineAttrItem plaiStroke,
BOOL  bDelete = TRUE,
String_256  strLabel = String_256()
 

Function : CBitmapGridDropDown::AddItem Author : Mikhail Tatarnikov Purpose : Adds an item and display a stroke in it. Returns : void Exceptions: Parameters: [in] LineAttrItem* plaiStroke - the stroke to display in the item; [in] String_256 strLabel - the item label. Notes :

Definition at line 652 of file bitmapgriddropdown.cpp.

00653 {
00654     CBGDDStrokeItem* pStrokeItem = new CBGDDStrokeItem(plaiStroke, bDelete, strLabel);
00655     CGridDropDown::AddItem(pStrokeItem);
00656 }

void CBitmapGridDropDown::AddItem KernelBitmap pKernelBitmap,
BOOL  bDelete = TRUE,
String_256  strLabel = String_256(),
BOOL  bStretch = TRUE
 

Function : CBitmapGridDropDown::AddItem Author : Mikhail Tatarnikov Purpose : Adds an item with a kernel bitmap Returns : void Exceptions: Parameters: [in] KernelBitmap* pKernelBitmap - the bitmap to be shown for the item; [in] String_256 strLabel - the item label. Notes :

Definition at line 635 of file bitmapgriddropdown.cpp.

00636 {
00637     CBGDDItemInfo* pData = new CBGDDKernelBitmapItem(pKernelBitmap, bDelete, strLabel, bStretch);
00638     CGridDropDown::AddItem(pData);
00639 }

void CBitmapGridDropDown::AddItem wxBitmap *  pBitmap,
BOOL  bDelete = TRUE,
String_256  strLabel = String_256(),
BOOL  bStretch = TRUE
 

Function : CBitmapGridDropDown::AddItem Author : Mikhail Tatarnikov Purpose : Adds an item with an image Returns : void Exceptions: Parameters: [in] wxBitmap* pBitmap - the bitmap to be shown for the item; [in] String_256 strLabel - the item label. Notes :

Definition at line 619 of file bitmapgriddropdown.cpp.

00620 {
00621     CBGDDItemInfo* pData = new CBGDDWxBitmapItem(pBitmap, bDelete, strLabel, bStretch);
00622     CGridDropDown::AddItem(pData);
00623 }

void CBitmapGridDropDown::AddItem UINT32  uiBitmapResID,
String_256  strLabel = String_256(),
BOOL  bStretch = TRUE
 

Function : CBitmapGridDropDown::AddItem Author : Mikhail Tatarnikov Purpose : Adds an item with an image from a resource Returns : void Exceptions: Parameters: [in] UINT32 uiBitmapResID - resource id with the image; [in] String_256 strLabel - label for the item. Notes :

Definition at line 603 of file bitmapgriddropdown.cpp.

00604 {
00605     CBGDDItemInfo* pData = new CBGDDResourceItem(uiBitmapResID, strLabel, bStretch);
00606     CGridDropDown::AddItem(pData);
00607 }

void CBitmapGridDropDown::DrawItemCore wxDC &  dc,
const wxRect &  rect,
INT32  iItem,
INT32  iFlags
[protected, virtual]
 

Function : CBitmapGridDropDown::DrawItemCore Author : Mikhail Tatarnikov Purpose : Draws the item core - the image itself Returns : void Exceptions: Parameters: [in] wxDC& dc - the device context to draw to; [in] wxRect& rect - the area of the item; [in] INT32 iItem - item index; [in] INT32 iFlags - additional flags (selected, highlighted, ...) Notes :

Implements CGridDropDown.

Definition at line 720 of file bitmapgriddropdown.cpp.

00721 {
00722     CBGDDItemInfo* pItemData = GetItemData(iItem);
00723 
00724     if (pItemData)
00725         pItemData->DrawItem(dc, rect, iFlags);
00726 }

CBGDDItemInfo * CBitmapGridDropDown::GetItemData INT32  iItem  )  [protected]
 

Function : CBitmapGridDropDown::GetItemData Author : Mikhail Tatarnikov Purpose : Gets the item data Returns : CBGDDItemInfo* - the user data associated with the item; Exceptions: Parameters: [in] INT32 iItem - the item index; Notes :

Reimplemented from CGridDropDown.

Definition at line 738 of file bitmapgriddropdown.cpp.

00739 {
00740     if (iItem == -1)
00741         return m_poUnselectedItem;
00742 
00743     return (CBGDDItemInfo*)CGridDropDown::GetItemData(iItem);
00744 }

wxBitmap* CBitmapGridDropDown::PreviewBrush AttrBrushType pabtBrush  )  [protected]
 

KernelBitmap * CBitmapGridDropDown::PreviewStroke LineAttrItem plaiStroke  )  [protected]
 

Function : CBitmapGridDropDown::PreviewStroke Author : Mikhail Tatarnikov Purpose : Preview a stroke into a bitmap Returns : KernelBitmap* - the stroke preview. Exceptions: Parameters: [in] LineAttrItem* plaiStroke - stroke to render. Notes :

Definition at line 789 of file bitmapgriddropdown.cpp.

00790 {
00791     wxMemoryDC dcMem;
00792 
00793     // Setup a memory DC to draw into a bitmap.
00794     wxSize szItem =  GetItemSize();
00795     wxBitmap* pBitmap = new wxBitmap(szItem.x, szItem.y);
00796     dcMem.SelectObject(*pBitmap);
00797 
00798     dcMem.SetTextForeground(wxColour(0, 0, 0));
00799 
00800     INT32 iDPI = 96;
00801 
00802     DialogView *pDialogView = new DialogView;
00803     pDialogView->Init();
00804     FIXED16 Scale(1);
00805 
00806     Matrix oMatrix(1, 0, 0, 1, 0, 0);
00807 
00808 
00809 
00810 
00811     DocRect rcDocClip;
00812     // Convert the item area to millipoints
00813     rcDocClip.lo.x = 0;
00814     rcDocClip.lo.y = 0;
00815 
00816     rcDocClip.hi.x = (szItem.x * 1000);
00817     rcDocClip.hi.y = (szItem.y * 1000);
00818 
00819 
00820     // Create a bitmap render region.
00821     GRenderBitmap* pRenderRegion = new GRenderBitmap(rcDocClip, oMatrix, Scale, 24, iDPI, FALSE, 0, NULL, TRUE);
00822     pRenderRegion->AttachDevice(pDialogView, &dcMem, NULL, false);
00823 
00824     // Prepare for the rendering.
00825     pRenderRegion->InitDevice();
00826     pRenderRegion->SaveContext();
00827     pRenderRegion->StartRender();
00828 
00829     // Render the stroke.
00830     plaiStroke->Render(pRenderRegion, rcDocClip, LineAttrItem::NO_LABEL);
00831 
00832     pRenderRegion->StopRender();
00833     pRenderRegion->RestoreContext();
00834 
00835     // WinBM Now needs to be setup with the newly created bitmap
00836     KernelBitmap* pKernelBitmap = new KernelBitmap(pRenderRegion->ExtractBitmapCopy(), TRUE);
00837 
00838 
00839     delete pRenderRegion;
00840     delete pDialogView;
00841 
00842     dcMem.SelectObject(wxNullBitmap);
00843     delete pBitmap;
00844 
00845     return pKernelBitmap;
00846 }

void CBitmapGridDropDown::SelectByLabel String_256  strLabel  ) 
 

Function : CBitmapGridDropDown::SelectByLabel Author : Mikhail Tatarnikov Purpose : Selects the element by label. Returns : void Exceptions: Parameters: [in] String_256 strLabel - the label of the existing item to select; Notes : If several items with the same label exist, the first one is to be selected. If no item's label match, the combobox is unselected.

Definition at line 756 of file bitmapgriddropdown.cpp.

00757 {
00758     // Walk over all items, looking for the first exact match.
00759     INT32 iSelectedIndex = -1;
00760     INT32 iItemsNum = GetItemsNum();
00761     for (INT32 i = 0; i < iItemsNum; ++i)
00762     {
00763         CBGDDItemInfo* pData = GetItemData(i);
00764         
00765         if (pData->GetLabel() == strLabel)
00766         {
00767             iSelectedIndex = i;
00768             break;
00769         }
00770         
00771     }
00772     
00773     SetSelected(iSelectedIndex);
00774 }

void CBitmapGridDropDown::SetUnselectedItem wxBitmap *  pBitmap,
String_256  strLabel = String_256()
 

Function : CBitmapGridDropDown::SetUnselectedItem Author : Mikhail Tatarnikov Purpose : Sets an image to be used as "unselected" item Returns : void Exceptions: Parameters: [in] wxBitmap* pBitmap - the bitmap to be shown for the "unselected" item; [in] String_256 strLabel - the item label. Notes :

Definition at line 702 of file bitmapgriddropdown.cpp.

00703 {
00704     m_poUnselectedItem = new CBGDDWxBitmapItem(pBitmap, TRUE, strLabel);
00705 }

void CBitmapGridDropDown::SetUnselectedItem UINT32  uiBitmapResID,
String_256  strLabel = String_256()
 

Function : CBitmapGridDropDown::SetUnselectedItem Author : Mikhail Tatarnikov Purpose : Sets an image to be used as "unselected" item Returns : void Exceptions: Parameters: [in] UINT32 uiBitmapResID - resource id with the image; [in] String_256 strLabel - label for the item. Notes :

Definition at line 686 of file bitmapgriddropdown.cpp.

00687 {
00688     m_poUnselectedItem = new CBGDDResourceItem(uiBitmapResID, strLabel);
00689 }


Friends And Related Function Documentation

friend class DialogManager [friend]
 

Definition at line 330 of file bitmapgriddropdown.h.


Member Data Documentation

CBGDDItemInfo* CBitmapGridDropDown::m_poUnselectedItem [protected]
 

Definition at line 357 of file bitmapgriddropdown.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:57 2007 for Camelot by  doxygen 1.4.4