wxComboCtrlBase Class Reference

#include <combo.h>

Inheritance diagram for wxComboCtrlBase:

wxGenericComboControl wxComboCtrl wxGridCombo wxOwnerDrawnComboBox wxSliderCombo List of all members.

Public Member Functions

 wxComboCtrlBase ()
bool Create (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, long style, const wxValidator &validator, const wxString &name)
virtual ~wxComboCtrlBase ()
virtual void ShowPopup ()
virtual void HidePopup ()
virtual void OnButtonClick ()
bool IsPopupShown () const
void SetPopupControl (wxComboPopup *popup)
wxComboPopupGetPopupControl ()
wxWindow * GetPopupWindow () const
wxTextCtrlGetTextCtrl () const
wxWindow * GetButton () const
virtual bool Enable (bool enable=true)
virtual bool Show (bool show=true)
virtual bool SetFont (const wxFont &font)
virtual wxString GetValue () const
virtual void SetValue (const wxString &value)
virtual void Copy ()
virtual void Cut ()
virtual void Paste ()
virtual void SetInsertionPoint (long pos)
virtual void SetInsertionPointEnd ()
virtual long GetInsertionPoint () const
virtual long GetLastPosition () const
virtual void Replace (long from, long to, const wxString &value)
virtual void Remove (long from, long to)
virtual void SetSelection (long from, long to)
virtual void Undo ()
void SetText (const wxString &value)
void SetPopupMinWidth (int width)
void SetPopupMaxHeight (int height)
void SetPopupExtents (int extLeft, int extRight)
void SetCustomPaintWidth (int width)
int GetCustomPaintWidth () const
void SetPopupAnchor (int anchorSide)
void SetButtonPosition (int width=-1, int height=-1, int side=wxRIGHT, int spacingX=0)
wxSize GetButtonSize ()
void SetButtonBitmaps (const wxBitmap &bmpNormal, bool pushButtonBg=false, const wxBitmap &bmpPressed=wxNullBitmap, const wxBitmap &bmpHover=wxNullBitmap, const wxBitmap &bmpDisabled=wxNullBitmap)
void SetTextIndent (int indent)
wxCoord GetTextIndent () const
virtual void DrawFocusBackground (wxDC &dc, const wxRect &rect, int flags) const
bool ShouldDrawFocus () const
const wxBitmap & GetBitmapNormal () const
const wxBitmap & GetBitmapPressed () const
const wxBitmap & GetBitmapHover () const
const wxBitmap & GetBitmapDisabled () const
wxUint32 GetInternalFlags () const
bool IsCreated () const
void OnPopupDismiss ()

Protected Member Functions

virtual void OnResize ()=0
virtual wxCoord GetNativeTextIndent () const
virtual void OnThemeChange ()
void CreateTextCtrl (int extraStyle, const wxValidator &validator)
void InstallInputHandlers (bool alsoTextCtrl=true)
void DrawButton (wxDC &dc, const wxRect &rect, bool paintBg=true)
bool HandleButtonMouseEvent (wxMouseEvent &event, int flags)
bool PreprocessMouseEvent (wxMouseEvent &event, int flags)
void HandleNormalMouseEvent (wxMouseEvent &event)
void CreatePopup ()
void DestroyPopup ()
virtual wxSize DoGetBestSize () const
virtual void DoSetPopupControl (wxComboPopup *popup)
void EnsurePopupControl ()
void CalculateAreas (int btnWidth=0)
void PositionTextCtrl (int textCtrlXAdjust, int textCtrlYAdjust)
void OnSizeEvent (wxSizeEvent &event)
void OnFocusEvent (wxFocusEvent &event)
void OnTextCtrlEvent (wxCommandEvent &event)
void OnSysColourChanged (wxSysColourChangedEvent &event)
void Customize (wxUint32 flags)
void RecalcAndRefresh ()
wxBitmap & GetBufferBitmap (const wxSize &sz) const

Protected Attributes

wxString m_valueString
wxTextCtrlm_text
wxWindow * m_btn
wxWindow * m_winPopup
wxWindow * m_popup
wxComboPopupm_popupInterface
wxEvtHandler * m_extraEvtHandler
wxEvtHandler * m_textEvtHandler
wxEvtHandler * m_toplevEvtHandler
wxEvtHandler * m_popupExtraHandler
wxLongLong m_timeLastMouseUp
wxLongLong m_timeCanAcceptClick
wxCoord m_extLeft
wxCoord m_extRight
wxCoord m_widthMinPopup
wxCoord m_heightPopup
wxCoord m_widthCustomPaint
wxCoord m_absIndent
int m_anchorSide
wxCoord m_widthCustomBorder
wxRect m_tcArea
wxRect m_btnArea
int m_btnState
int m_btnWid
int m_btnHei
int m_btnSide
int m_btnSpacingX
int m_btnWidDefault
wxBitmap m_bmpNormal
wxBitmap m_bmpPressed
wxBitmap m_bmpHover
wxBitmap m_bmpDisabled
wxSize m_btnSize
wxUint32 m_iFlags
bool m_blankButtonBg
bool m_isPopupShown
bool m_downReceived

Private Member Functions

void Init ()

Friends

class wxComboPopup

Detailed Description

Definition at line 130 of file combo.h.


Constructor & Destructor Documentation

wxComboCtrlBase::wxComboCtrlBase  )  [inline]
 

Definition at line 135 of file combo.h.

00135 : wxControl() { Init(); }

wxComboCtrlBase::~wxComboCtrlBase  )  [virtual]
 

Definition at line 750 of file combo.cpp.

00751 {
00752     if ( HasCapture() )
00753         ReleaseMouse();
00754 
00755     delete gs_doubleBuffer;
00756     gs_doubleBuffer = (wxBitmap*) NULL;
00757 
00758 #if INSTALL_TOPLEV_HANDLER
00759     delete ((wxComboFrameEventHandler*)m_toplevEvtHandler);
00760     m_toplevEvtHandler = (wxEvtHandler*) NULL;
00761 #endif
00762 
00763     DestroyPopup();
00764 
00765     RemoveEventHandler(m_extraEvtHandler);
00766 
00767     if ( m_text )
00768         m_text->RemoveEventHandler(m_textEvtHandler);
00769 
00770     delete m_textEvtHandler;
00771     delete m_extraEvtHandler;
00772 }


Member Function Documentation

void wxComboCtrlBase::CalculateAreas int  btnWidth = 0  )  [protected]
 

Definition at line 780 of file combo.cpp.

00781 {
00782     wxSize sz = GetClientSize();
00783     int customBorder = m_widthCustomBorder;
00784     int btnBorder; // border for button only
00785 
00786     // check if button should really be outside the border: we'll do it it if
00787     // its platform default or bitmap+pushbutton background is used, but not if
00788     // there is vertical size adjustment or horizontal spacing.
00789     if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ||
00790                 (m_bmpNormal.Ok() && m_blankButtonBg) ) &&
00791          m_btnSpacingX == 0 &&
00792          m_btnHei <= 0 )
00793     {
00794         m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE;
00795         btnBorder = 0;
00796     }
00797     else
00798     {
00799         m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE);
00800         btnBorder = customBorder;
00801     }
00802 
00803     // Defaul indentation
00804     if ( m_absIndent < 0 )
00805         m_absIndent = GetNativeTextIndent();
00806 
00807     int butWidth = btnWidth;
00808 
00809     if ( butWidth <= 0 )
00810         butWidth = m_btnWidDefault;
00811     else
00812         m_btnWidDefault = butWidth;
00813 
00814     if ( butWidth <= 0 )
00815         return;
00816 
00817     int butHeight = sz.y - btnBorder*2;
00818 
00819     // Adjust button width
00820     if ( m_btnWid > 0 )
00821         butWidth = m_btnWid;
00822     else
00823     {
00824         // Adjust button width to match aspect ratio
00825         // (but only if control is smaller than best size).
00826         int bestHeight = GetBestSize().y;
00827         int height = GetSize().y;
00828 
00829         if ( height < bestHeight )
00830         {
00831             // Make very small buttons square, as it makes
00832             // them accommodate arrow image better and still
00833             // looks decent.
00834             if ( height > 18 )
00835                 butWidth = (height*butWidth)/bestHeight;
00836             else
00837                 butWidth = butHeight;
00838         }
00839     }
00840 
00841     // Adjust button height
00842     if ( m_btnHei > 0 )
00843         butHeight = m_btnHei;
00844 
00845     // Use size of normal bitmap if...
00846     //   It is larger
00847     //   OR
00848     //   button width is set to default and blank button bg is not drawn
00849     if ( m_bmpNormal.Ok() )
00850     {
00851         int bmpReqWidth = m_bmpNormal.GetWidth();
00852         int bmpReqHeight = m_bmpNormal.GetHeight();
00853 
00854         // If drawing blank button background, we need to add some margin.
00855         if ( m_blankButtonBg )
00856         {
00857             bmpReqWidth += BMP_BUTTON_MARGIN*2;
00858             bmpReqHeight += BMP_BUTTON_MARGIN*2;
00859         }
00860 
00861         if ( butWidth < bmpReqWidth || ( m_btnWid == 0 && !m_blankButtonBg ) )
00862             butWidth = bmpReqWidth;
00863         if ( butHeight < bmpReqHeight || ( m_btnHei == 0 && !m_blankButtonBg ) )
00864             butHeight = bmpReqHeight;
00865 
00866         // Need to fix height?
00867         if ( (sz.y-(customBorder*2)) < butHeight && btnWidth == 0 )
00868         {
00869             int newY = butHeight+(customBorder*2);
00870             SetClientSize(wxDefaultCoord,newY);
00871             sz.y = newY;
00872         }
00873     }
00874 
00875     int butAreaWid = butWidth + (m_btnSpacingX*2);
00876 
00877     m_btnSize.x = butWidth;
00878     m_btnSize.y = butHeight;
00879 
00880     m_btnArea.x = ( m_btnSide==wxRIGHT ? sz.x - butAreaWid - btnBorder : btnBorder );
00881     m_btnArea.y = btnBorder;
00882     m_btnArea.width = butAreaWid;
00883     m_btnArea.height = sz.y - (btnBorder*2);
00884 
00885     m_tcArea.x = ( m_btnSide==wxRIGHT ? 0 : butAreaWid ) + customBorder;
00886     m_tcArea.y = customBorder;
00887     m_tcArea.width = sz.x - butAreaWid - (customBorder*2);
00888     m_tcArea.height = sz.y - (customBorder*2);
00889 
00890 /*
00891     if ( m_text )
00892     {
00893         ::wxMessageBox(wxString::Format(wxT("ButtonArea (%i,%i,%i,%i)\n"),m_btnArea.x,m_btnArea.y,m_btnArea.width,m_btnArea.height) +
00894                        wxString::Format(wxT("TextCtrlArea (%i,%i,%i,%i)"),m_tcArea.x,m_tcArea.y,m_tcArea.width,m_tcArea.height));
00895     }
00896 */
00897 }

void wxComboCtrlBase::Copy  )  [virtual]
 

Definition at line 1970 of file combo.cpp.

01971 {
01972     if ( m_text )
01973         m_text->Copy();
01974 }

bool wxComboCtrlBase::Create wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos,
const wxSize &  size,
long  style,
const wxValidator &  validator,
const wxString &  name
 

Reimplemented in wxGenericComboControl, and wxOwnerDrawnComboBox.

Definition at line 672 of file combo.cpp.

00680 {
00681     if ( !wxControl::Create(parent,
00682                             id,
00683                             pos,
00684                             size,
00685                             style | wxWANTS_CHARS,
00686                             validator,
00687                             name) )
00688         return false;
00689 
00690     m_valueString = value;
00691 
00692     // Get colours
00693     OnThemeChange();
00694     m_absIndent = GetNativeTextIndent();
00695 
00696     m_iFlags |= wxCC_IFLAG_CREATED;
00697 
00698     // If x and y indicate valid size, wxSizeEvent won't be
00699     // emitted automatically, so we need to add artifical one.
00700     if ( size.x > 0 && size.y > 0 )
00701     {
00702         wxSizeEvent evt(size,GetId());
00703         GetEventHandler()->AddPendingEvent(evt);
00704     }
00705 
00706     return true;
00707 }

void wxComboCtrlBase::CreatePopup  )  [protected]
 

Definition at line 1500 of file combo.cpp.

01501 {
01502     wxComboPopup* popupInterface = m_popupInterface;
01503     wxWindow* popup;
01504 
01505     if ( !m_winPopup )
01506         m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER );
01507 
01508     popupInterface->Create(m_winPopup);
01509     m_popup = popup = popupInterface->GetControl();
01510 
01511     m_popupExtraHandler = new wxComboPopupExtraEventHandler(this);
01512     popup->PushEventHandler( m_popupExtraHandler );
01513 
01514     // This may be helpful on some platforms
01515     //   (eg. it bypasses a wxGTK popupwindow bug where
01516     //    window is not initially hidden when it should be)
01517     m_winPopup->Hide();
01518 
01519     popupInterface->m_iFlags |= wxCP_IFLAG_CREATED;
01520 }

void wxComboCtrlBase::CreateTextCtrl int  extraStyle,
const wxValidator &  validator
[protected]
 

Definition at line 723 of file combo.cpp.

00724 {
00725     if ( !(m_windowStyle & wxCB_READONLY) )
00726     {
00727         // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
00728         // not used by the wxPropertyGrid and therefore the tab is processed by
00729         // looking at ancestors to see if they have wxTAB_TRAVERSAL. The
00730         // navigation event is then sent to the wrong window.
00731         style |= wxTE_PROCESS_TAB;
00732 
00733         if ( HasFlag(wxTE_PROCESS_ENTER) )
00734             style |= wxTE_PROCESS_ENTER;
00735 
00736         m_text = new wxTextCtrl(this, wxID_ANY, m_valueString,
00737                                 wxDefaultPosition, wxDefaultSize,
00738                                 style, validator);
00739 
00740         // This is required for some platforms (GTK+ atleast)
00741         m_text->SetSizeHints(2,4);
00742     }
00743 }

void wxComboCtrlBase::Customize wxUint32  flags  )  [inline, protected]
 

Definition at line 412 of file combo.h.

00412 { m_iFlags |= flags; }

void wxComboCtrlBase::Cut  )  [virtual]
 

Definition at line 1976 of file combo.cpp.

01977 {
01978     if ( m_text )
01979         m_text->Cut();
01980 }

void wxComboCtrlBase::DestroyPopup  )  [protected]
 

Definition at line 1523 of file combo.cpp.

01524 {
01525     if ( m_popup )
01526         m_popup->RemoveEventHandler(m_popupExtraHandler);
01527 
01528     delete m_popupExtraHandler;
01529 
01530     HidePopup();
01531 
01532     delete m_popupInterface;
01533 
01534     if ( m_winPopup )
01535         m_winPopup->Destroy();
01536 
01537     m_popupExtraHandler = (wxEvtHandler*) NULL;
01538     m_popupInterface = (wxComboPopup*) NULL;
01539     m_winPopup = (wxWindow*) NULL;
01540     m_popup = (wxWindow*) NULL;
01541 }

wxSize wxComboCtrlBase::DoGetBestSize  )  const [protected, virtual]
 

Definition at line 941 of file combo.cpp.

00942 {
00943     wxSize sizeText(150,0);
00944 
00945     if ( m_text )
00946         sizeText = m_text->GetBestSize();
00947 
00948     // TODO: Better method to calculate close-to-native control height.
00949 
00950     int fhei;
00951     if ( m_font.Ok() )
00952         fhei = (m_font.GetPointSize()*2) + 5;
00953     else if ( wxNORMAL_FONT->Ok() )
00954         fhei = (wxNORMAL_FONT->GetPointSize()*2) + 5;
00955     else
00956         fhei = sizeText.y + 4;
00957 
00958     // Need to force height to accomodate bitmap?
00959     int btnSizeY = m_btnSize.y;
00960     if ( m_bmpNormal.Ok() && fhei < btnSizeY )
00961         fhei = btnSizeY;
00962 
00963     // Control height doesn't depend on border
00964 /*
00965     // Add border
00966     int border = m_windowStyle & wxBORDER_MASK;
00967     if ( border == wxSIMPLE_BORDER )
00968         fhei += 2;
00969     else if ( border == wxNO_BORDER )
00970         fhei += (m_widthCustomBorder*2);
00971     else
00972         // Sunken etc.
00973         fhei += 4;
00974 */
00975 
00976     // Final adjustments
00977 #ifdef __WXGTK__
00978     fhei += 1;
00979 #endif
00980 
00981     wxSize ret(sizeText.x + COMBO_MARGIN + DEFAULT_DROPBUTTON_WIDTH,
00982                fhei);
00983 
00984     CacheBestSize(ret);
00985     return ret;
00986 }

void wxComboCtrlBase::DoSetPopupControl wxComboPopup popup  )  [protected, virtual]
 

Reimplemented in wxOwnerDrawnComboBox.

Definition at line 1543 of file combo.cpp.

01544 {
01545     wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") );
01546 
01547     DestroyPopup();
01548 
01549     iface->InitBase(this);
01550     iface->Init();
01551 
01552     m_popupInterface = iface;
01553 
01554     if ( !iface->LazyCreate() )
01555     {
01556         CreatePopup();
01557     }
01558     else
01559     {
01560         m_popup = (wxWindow*) NULL;
01561     }
01562 
01563     // This must be done after creation
01564     if ( m_valueString.length() )
01565     {
01566         iface->SetStringValue(m_valueString);
01567         //Refresh();
01568     }
01569 }

void wxComboCtrlBase::DrawButton wxDC &  dc,
const wxRect &  rect,
bool  paintBg = true
[protected]
 

Definition at line 1137 of file combo.cpp.

01138 {
01139     int drawState = m_btnState;
01140 
01141 #ifdef __WXGTK__
01142     if ( m_isPopupShown )
01143         drawState |= wxCONTROL_PRESSED;
01144 #endif
01145 
01146     wxRect drawRect(rect.x+m_btnSpacingX,
01147                     rect.y+((rect.height-m_btnSize.y)/2),
01148                     m_btnSize.x,
01149                     m_btnSize.y);
01150 
01151     // Make sure area is not larger than the control
01152     if ( drawRect.y < rect.y )
01153         drawRect.y = rect.y;
01154     if ( drawRect.height > rect.height )
01155         drawRect.height = rect.height;
01156 
01157     bool enabled = IsEnabled();
01158 
01159     if ( !enabled )
01160         drawState |= wxCONTROL_DISABLED;
01161 
01162     if ( !m_bmpNormal.Ok() )
01163     {
01164         // Need to clear button background even if m_btn is present
01165         if ( paintBg )
01166         {
01167             wxColour bgCol;
01168 
01169             if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE )
01170                 bgCol = GetParent()->GetBackgroundColour();
01171             else
01172                 bgCol = GetBackgroundColour();
01173 
01174             dc.SetBrush(bgCol);
01175             dc.SetPen(bgCol);
01176             dc.DrawRectangle(rect);
01177         }
01178 
01179         // Draw standard button
01180         wxRendererNative::Get().DrawComboBoxDropButton(this,
01181                                                        dc,
01182                                                        drawRect,
01183                                                        drawState);
01184     }
01185     else
01186     {
01187         // Draw bitmap
01188 
01189         wxBitmap* pBmp;
01190 
01191         if ( !enabled )
01192             pBmp = &m_bmpDisabled;
01193         else if ( m_btnState & wxCONTROL_PRESSED )
01194             pBmp = &m_bmpPressed;
01195         else if ( m_btnState & wxCONTROL_CURRENT )
01196             pBmp = &m_bmpHover;
01197         else
01198             pBmp = &m_bmpNormal;
01199 
01200         if ( m_blankButtonBg )
01201         {
01202             // If using blank button background, we need to clear its background
01203             // with button face colour instead of colour for rest of the control.
01204             if ( paintBg )
01205             {
01206                 wxColour bgCol = GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
01207                 //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
01208                 dc.SetPen(bgCol);
01209                 dc.SetBrush(bgCol);
01210                 dc.DrawRectangle(rect);
01211             }
01212 #if 0
01213             wxRendererNative::Get().DrawPushButton(this,
01214                                                    dc,
01215                                                    drawRect,
01216                                                    drawState);
01217 #endif
01218         }
01219         else
01220 
01221         {
01222             // Need to clear button background even if m_btn is present
01223             // (assume non-button background was cleared just before this call so brushes are good)
01224             if ( paintBg )
01225                 dc.DrawRectangle(rect);
01226         }
01227 
01228         // Draw bitmap centered in drawRect
01229         dc.DrawBitmap(*pBmp,
01230                       drawRect.x + (drawRect.width-pBmp->GetWidth())/2,
01231                       drawRect.y + (drawRect.height-pBmp->GetHeight())/2,
01232                       true);
01233     }
01234 }

void wxComboCtrlBase::DrawFocusBackground wxDC &  dc,
const wxRect &  rect,
int  flags
const [virtual]
 

Definition at line 1066 of file combo.cpp.

01067 {
01068     wxSize sz = GetClientSize();
01069     bool isEnabled;
01070     bool isFocused; // also selected
01071 
01072     // For smaller size control (and for disabled background) use less spacing
01073     int focusSpacingX;
01074     int focusSpacingY;
01075 
01076     if ( !(flags & wxCONTROL_ISSUBMENU) )
01077     {
01078         // Drawing control
01079         isEnabled = IsEnabled();
01080         isFocused = ShouldDrawFocus();
01081 
01082         // Windows-style: for smaller size control (and for disabled background) use less spacing
01083         focusSpacingX = isEnabled ? 2 : 1;
01084         focusSpacingY = sz.y > (GetCharHeight()+2) && isEnabled ? 2 : 1;
01085     }
01086     else
01087     {
01088         // Drawing a list item
01089         isEnabled = true; // they are never disabled
01090         isFocused = flags & wxCONTROL_SELECTED ? true : false;
01091 
01092         focusSpacingX = 0;
01093         focusSpacingY = 0;
01094     }
01095 
01096     // Set the background sub-rectangle for selection, disabled etc
01097     wxRect selRect(rect);
01098     selRect.y += focusSpacingY;
01099     selRect.height -= (focusSpacingY*2);
01100 
01101     int wcp = 0;
01102 
01103     if ( !(flags & wxCONTROL_ISSUBMENU) )
01104         wcp += m_widthCustomPaint;
01105 
01106     selRect.x += wcp + focusSpacingX;
01107     selRect.width -= wcp + (focusSpacingX*2);
01108 
01109     wxColour bgCol;
01110 
01111     if ( isEnabled )
01112     {
01113         // If popup is hidden and this control is focused,
01114         // then draw the focus-indicator (selbgcolor background etc.).
01115         if ( isFocused )
01116         {
01117             dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) );
01118             bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
01119         }
01120         else
01121         {
01122             dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) );
01123             bgCol = GetBackgroundColour();
01124         }
01125     }
01126     else
01127     {
01128         dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT) );
01129         bgCol = GetBackgroundColour();
01130     }
01131 
01132     dc.SetBrush( bgCol );
01133     dc.SetPen( bgCol );
01134     dc.DrawRectangle( selRect );
01135 }

bool wxComboCtrlBase::Enable bool  enable = true  )  [virtual]
 

Definition at line 1003 of file combo.cpp.

01004 {
01005     if ( !wxControl::Enable(enable) )
01006         return false;
01007 
01008     if ( m_btn )
01009         m_btn->Enable(enable);
01010     if ( m_text )
01011         m_text->Enable(enable);
01012 
01013     return true;
01014 }

void wxComboCtrlBase::EnsurePopupControl  )  [protected]
 

Definition at line 1572 of file combo.cpp.

01573 {
01574     if ( !m_popupInterface )
01575         SetPopupControl(NULL);
01576 }

const wxBitmap& wxComboCtrlBase::GetBitmapDisabled  )  const [inline]
 

Definition at line 328 of file combo.h.

00328 { return m_bmpDisabled; }

const wxBitmap& wxComboCtrlBase::GetBitmapHover  )  const [inline]
 

Definition at line 327 of file combo.h.

00327 { return m_bmpHover; }

const wxBitmap& wxComboCtrlBase::GetBitmapNormal  )  const [inline]
 

Definition at line 325 of file combo.h.

00325 { return m_bmpNormal; }

const wxBitmap& wxComboCtrlBase::GetBitmapPressed  )  const [inline]
 

Definition at line 326 of file combo.h.

00326 { return m_bmpPressed; }

wxBitmap & wxComboCtrlBase::GetBufferBitmap const wxSize &  sz  )  const [protected]
 

Definition at line 1246 of file combo.cpp.

01247 {
01248     // If size is larger, recalculate double buffer bitmap
01249     if ( !gs_doubleBuffer ||
01250          sz.x > gs_doubleBuffer->GetWidth() ||
01251          sz.y > gs_doubleBuffer->GetHeight() )
01252     {
01253         delete gs_doubleBuffer;
01254         gs_doubleBuffer = new wxBitmap(sz.x+25,sz.y);
01255     }
01256     return *gs_doubleBuffer;
01257 }

wxWindow* wxComboCtrlBase::GetButton  )  const [inline]
 

Definition at line 180 of file combo.h.

00180 { return m_btn; }

wxSize wxComboCtrlBase::GetButtonSize  ) 
 

Definition at line 1842 of file combo.cpp.

01843 {
01844     if ( m_btnSize.x > 0 )
01845         return m_btnSize;
01846 
01847     wxSize retSize(m_btnWid,m_btnHei);
01848 
01849     // Need to call CalculateAreas now if button size is
01850     // is not explicitly specified.
01851     if ( retSize.x <= 0 || retSize.y <= 0)
01852     {
01853         OnResize();
01854 
01855         retSize = m_btnSize;
01856     }
01857 
01858     return retSize;
01859 }

int wxComboCtrlBase::GetCustomPaintWidth  )  const [inline]
 

Definition at line 245 of file combo.h.

00245 { return m_widthCustomPaint; }

long wxComboCtrlBase::GetInsertionPoint  )  const [virtual]
 

Definition at line 2000 of file combo.cpp.

02001 {
02002     if ( m_text )
02003         return m_text->GetInsertionPoint();
02004 
02005     return 0;
02006 }

wxUint32 wxComboCtrlBase::GetInternalFlags  )  const [inline]
 

Definition at line 331 of file combo.h.

00331 { return m_iFlags; }

long wxComboCtrlBase::GetLastPosition  )  const [virtual]
 

Definition at line 2008 of file combo.cpp.

02009 {
02010     if ( m_text )
02011         return m_text->GetLastPosition();
02012 
02013     return 0;
02014 }

wxCoord wxComboCtrlBase::GetNativeTextIndent  )  const [protected, virtual]
 

Definition at line 1921 of file combo.cpp.

01922 {
01923     return DEFAULT_TEXT_INDENT;
01924 }

wxComboPopup* wxComboCtrlBase::GetPopupControl  )  [inline]
 

Definition at line 166 of file combo.h.

00167     {
00168         EnsurePopupControl();
00169         return m_popupInterface;
00170     }

wxWindow* wxComboCtrlBase::GetPopupWindow  )  const [inline]
 

Definition at line 173 of file combo.h.

00173 { return m_winPopup; }

wxTextCtrl* wxComboCtrlBase::GetTextCtrl  )  const [inline]
 

Definition at line 176 of file combo.h.

00176 { return m_text; }

wxCoord wxComboCtrlBase::GetTextIndent  )  const [inline]
 

Definition at line 296 of file combo.h.

00297     {
00298         return m_absIndent;
00299     }

wxString wxComboCtrlBase::GetValue  )  const [virtual]
 

Definition at line 1930 of file combo.cpp.

01931 {
01932     if ( m_text )
01933         return m_text->GetValue();
01934     return m_valueString;
01935 }

bool wxComboCtrlBase::HandleButtonMouseEvent wxMouseEvent &  event,
int  flags
[protected]
 

Definition at line 1274 of file combo.cpp.

01276 {
01277     int type = event.GetEventType();
01278 
01279     if ( type == wxEVT_MOTION )
01280     {
01281         if ( flags & wxCC_MF_ON_BUTTON )
01282         {
01283             if ( !(m_btnState & wxCONTROL_CURRENT) )
01284             {
01285                 // Mouse hover begins
01286                 m_btnState |= wxCONTROL_CURRENT;
01287                 if ( HasCapture() ) // Retain pressed state.
01288                     m_btnState |= wxCONTROL_PRESSED;
01289                 Refresh();
01290             }
01291         }
01292         else if ( (m_btnState & wxCONTROL_CURRENT) )
01293         {
01294             // Mouse hover ends
01295             m_btnState &= ~(wxCONTROL_CURRENT|wxCONTROL_PRESSED);
01296             Refresh();
01297         }
01298     }
01299     else if ( type == wxEVT_LEFT_DOWN )
01300     {
01301         // Only accept event if it wasn't right after popup dismiss
01302         //if ( ::wxGetLocalTimeMillis() > m_timeCanClick )
01303         {
01304             // Need to test this, because it might be outside.
01305             if ( flags & wxCC_MF_ON_BUTTON )
01306             {
01307                 m_btnState |= wxCONTROL_PRESSED;
01308                 Refresh();
01309 
01310                 if ( !(m_iFlags & wxCC_POPUP_ON_MOUSE_UP) )
01311                     OnButtonClick();
01312                 else
01313                     // If showing popup now, do not capture mouse or there will be interference
01314                     CaptureMouse();
01315             }
01316         }
01317         /*else
01318         {
01319             m_btnState = 0;
01320         }*/
01321     }
01322     else if ( type == wxEVT_LEFT_UP )
01323     {
01324 
01325         // Only accept event if mouse was left-press was previously accepted
01326         if ( HasCapture() )
01327             ReleaseMouse();
01328 
01329         if ( m_btnState & wxCONTROL_PRESSED )
01330         {
01331             // If mouse was inside, fire the click event.
01332             if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP )
01333             {
01334                 if ( flags & wxCC_MF_ON_BUTTON )
01335                     OnButtonClick();
01336             }
01337 
01338             m_btnState &= ~(wxCONTROL_PRESSED);
01339             Refresh();
01340         }
01341     }
01342     else if ( type == wxEVT_LEAVE_WINDOW )
01343     {
01344         if ( m_btnState & (wxCONTROL_CURRENT|wxCONTROL_PRESSED) )
01345         {
01346             m_btnState &= ~(wxCONTROL_CURRENT);
01347 
01348             // Mouse hover ends
01349             if ( !m_isPopupShown )
01350             {
01351                 m_btnState &= ~(wxCONTROL_PRESSED);
01352                 Refresh();
01353             }
01354         }
01355     }
01356     else
01357         return false;
01358 
01359     return true;
01360 }

void wxComboCtrlBase::HandleNormalMouseEvent wxMouseEvent &  event  )  [protected]
 

Definition at line 1423 of file combo.cpp.

01424 {
01425     int evtType = event.GetEventType();
01426 
01427     if ( (evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_LEFT_DCLICK) &&
01428          (m_windowStyle & wxCB_READONLY) )
01429     {
01430         if ( m_isPopupShown )
01431         {
01432     #if !wxUSE_POPUPWIN
01433         // Normally do nothing - evt handler should close it for us
01434     #elif !USE_TRANSIENT_POPUP
01435             // Click here always hides the popup.
01436             HidePopup();
01437     #endif
01438         }
01439         else
01440         {
01441             if ( !(m_windowStyle & wxCC_SPECIAL_DCLICK) )
01442             {
01443                 // In read-only mode, clicking the text is the
01444                 // same as clicking the button.
01445                 OnButtonClick();
01446             }
01447             else if ( /*evtType == wxEVT_LEFT_UP || */evtType == wxEVT_LEFT_DCLICK )
01448             {
01449                 //if ( m_popupInterface->CycleValue() )
01450                 //    Refresh();
01451                 if ( m_popupInterface )
01452                     m_popupInterface->OnComboDoubleClick();
01453             }
01454         }
01455     }
01456     else
01457     if ( m_isPopupShown )
01458     {
01459         // relay (some) mouse events to the popup
01460         if ( evtType == wxEVT_MOUSEWHEEL )
01461             m_popup->AddPendingEvent(event);
01462     }
01463     else if ( evtType )
01464         event.Skip();
01465 }

void wxComboCtrlBase::HidePopup  )  [virtual]
 

Definition at line 1808 of file combo.cpp.

01809 {
01810     // Should be able to call this without popup interface
01811     //wxCHECK_RET( m_popupInterface, _T("no popup interface") );
01812     if ( !m_isPopupShown )
01813         return;
01814 
01815     // transfer value and show it in textctrl, if any
01816     SetValue( m_popupInterface->GetStringValue() );
01817 
01818 #if USE_TRANSIENT_POPUP
01819     ((wxPopupTransientWindow*)m_winPopup)->Dismiss();
01820 #else
01821     m_winPopup->Hide();
01822 #endif
01823 
01824     OnPopupDismiss();
01825 }

void wxComboCtrlBase::Init  )  [private]
 

Reimplemented in wxGenericComboControl, wxGridCombo, wxOwnerDrawnComboBox, and wxSliderCombo.

Definition at line 634 of file combo.cpp.

00635 {
00636     m_winPopup = (wxWindow *)NULL;
00637     m_popup = (wxWindow *)NULL;
00638     m_isPopupShown = false;
00639     m_btn = (wxWindow*) NULL;
00640     m_text = (wxTextCtrl*) NULL;
00641     m_popupInterface = (wxComboPopup*) NULL;
00642 
00643     m_extraEvtHandler = (wxEvtHandler*) NULL;
00644     m_popupExtraHandler = (wxEvtHandler*) NULL;
00645     m_textEvtHandler = (wxEvtHandler*) NULL;
00646 
00647 #if INSTALL_TOPLEV_HANDLER
00648     m_toplevEvtHandler = (wxEvtHandler*) NULL;