#include <bitmapgriddropdown.h>
Inheritance diagram for CBitmapGridDropDown:
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 | |
CBGDDItemInfo * | GetItemData (INT32 iItem) |
virtual void | DrawItemCore (wxDC &dc, const wxRect &rect, INT32 iItem, INT32 iFlags) |
wxBitmap * | PreviewBrush (AttrBrushType *pabtBrush) |
KernelBitmap * | PreviewStroke (LineAttrItem *plaiStroke) |
Protected Attributes | |
CBGDDItemInfo * | m_poUnselectedItem |
Friends | |
class | DialogManager |
Definition at line 328 of file bitmapgriddropdown.h.
|
Definition at line 581 of file bitmapgriddropdown.cpp. 00582 { 00583 m_poUnselectedItem = NULL; 00584 }
|
|
Definition at line 588 of file bitmapgriddropdown.cpp.
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
Definition at line 330 of file bitmapgriddropdown.h. |
|
Definition at line 357 of file bitmapgriddropdown.h. |