#include <combo.h>
Inheritance diagram for wxComboCtrlBase:
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) |
wxComboPopup * | GetPopupControl () |
wxWindow * | GetPopupWindow () const |
wxTextCtrl * | GetTextCtrl () 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 |
wxTextCtrl * | m_text |
wxWindow * | m_btn |
wxWindow * | m_winPopup |
wxWindow * | m_popup |
wxComboPopup * | m_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 |
Definition at line 130 of file combo.h.
|
Definition at line 135 of file combo.h. 00135 : wxControl() { Init(); }
|
|
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 }
|
|
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 }
|
|
Definition at line 1970 of file combo.cpp.
|
|
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 }
|
|
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 }
|
|
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 }
|
|
Definition at line 412 of file combo.h. 00412 { m_iFlags |= flags; }
|
|
Definition at line 1976 of file combo.cpp.
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
Definition at line 1572 of file combo.cpp. 01573 { 01574 if ( !m_popupInterface ) 01575 SetPopupControl(NULL); 01576 }
|
|
Definition at line 328 of file combo.h. 00328 { return m_bmpDisabled; }
|
|
Definition at line 327 of file combo.h. 00327 { return m_bmpHover; }
|
|
Definition at line 325 of file combo.h. 00325 { return m_bmpNormal; }
|
|
Definition at line 326 of file combo.h. 00326 { return m_bmpPressed; }
|
|
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 }
|
|
Definition at line 180 of file combo.h. 00180 { return m_btn; }
|
|
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 }
|
|
Definition at line 245 of file combo.h. 00245 { return m_widthCustomPaint; }
|
|
Definition at line 2000 of file combo.cpp.
|
|
Definition at line 331 of file combo.h. 00331 { return m_iFlags; }
|
|
Definition at line 2008 of file combo.cpp.
|
|
Definition at line 1921 of file combo.cpp. 01922 { 01923 return DEFAULT_TEXT_INDENT; 01924 }
|
|
Definition at line 166 of file combo.h. 00167 { 00168 EnsurePopupControl(); 00169 return m_popupInterface; 00170 }
|
|
Definition at line 173 of file combo.h. 00173 { return m_winPopup; }
|
|
Definition at line 176 of file combo.h. 00176 { return m_text; }
|
|
Definition at line 296 of file combo.h. 00297 { 00298 return m_absIndent; 00299 }
|
|
Definition at line 1930 of file combo.cpp. 01931 { 01932 if ( m_text ) 01933 return m_text->GetValue(); 01934 return m_valueString; 01935 }
|
|
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 }
|
|
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 }
|
|
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 }
|
|
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; 00649 #endif 00650 00651 m_heightPopup = -1; 00652 m_widthMinPopup = -1; 00653 m_anchorSide = 0; 00654 m_widthCustomPaint = 0; 00655 m_widthCustomBorder = 0; 00656 00657 m_btnState = 0; 00658 m_btnWidDefault = 0; 00659 m_blankButtonBg = false; 00660 m_btnWid = m_btnHei = -1; 00661 m_btnSide = wxRIGHT; 00662 m_btnSpacingX = 0; 00663 00664 m_extLeft = 0; 00665 m_extRight = 0; 00666 m_absIndent = -1; 00667 m_iFlags = 0; 00668 m_downReceived = false; 00669 m_timeCanAcceptClick = 0; 00670 }
|
|
Definition at line 709 of file combo.cpp. 00710 { 00711 if ( m_text && alsoTextCtrl ) 00712 { 00713 m_textEvtHandler = new wxComboBoxExtraInputHandler(this); 00714 m_text->PushEventHandler(m_textEvtHandler); 00715 } 00716 00717 wxComboBoxExtraInputHandler* inputHandler = new wxComboBoxExtraInputHandler(this); 00718 PushEventHandler(inputHandler); 00719 m_extraEvtHandler = inputHandler; 00720 }
|
|
Definition at line 334 of file combo.h. 00334 { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; }
|
|
Definition at line 156 of file combo.h. 00156 { return m_isPopupShown; }
|
|
Definition at line 1578 of file combo.cpp. 01579 { 01580 // Derived classes can override this method for totally custom 01581 // popup action 01582 ShowPopup(); 01583 }
|
|
Definition at line 1467 of file combo.cpp. 01468 { 01469 // First click is the first part of double-click 01470 // Some platforms don't generate down-less mouse up-event 01471 // (Windows does, GTK+2 doesn't), so that's why we have 01472 // to do this. 01473 m_timeLastMouseUp = ::wxGetLocalTimeMillis(); 01474 01475 if ( m_text ) 01476 { 01477 m_text->SetFocus(); 01478 } 01479 else 01480 // no need to check for m_widthCustomPaint - that 01481 // area never gets special handling when selected 01482 // (in writable mode, that is) 01483 Refresh(); 01484 }
|
|
Definition at line 1758 of file combo.cpp. 01759 { 01760 // Just in case, avoid double dismiss 01761 if ( !m_isPopupShown ) 01762 return; 01763 01764 // *Must* set this before focus etc. 01765 m_isPopupShown = false; 01766 01767 // Inform popup control itself 01768 m_popupInterface->OnDismiss(); 01769 01770 if ( m_popupExtraHandler ) 01771 ((wxComboPopupExtraEventHandler*)m_popupExtraHandler)->OnPopupDismiss(); 01772 01773 #if INSTALL_TOPLEV_HANDLER 01774 // Remove top level window event handler 01775 if ( m_toplevEvtHandler ) 01776 { 01777 wxWindow* toplev = ::wxGetTopLevelParent( this ); 01778 if ( toplev ) 01779 toplev->RemoveEventHandler( m_toplevEvtHandler ); 01780 } 01781 #endif 01782 01783 m_timeCanAcceptClick = ::wxGetLocalTimeMillis() + 150; 01784 01785 // If cursor not on dropdown button, then clear its state 01786 // (technically not required by all ports, but do it for all just in case) 01787 if ( !m_btnArea.Inside(ScreenToClient(::wxGetMousePosition())) ) 01788 m_btnState = 0; 01789 01790 // Return parent's tab traversal flag. 01791 // See ShowPopup for notes. 01792 if ( m_iFlags & wxCC_IFLAG_PARENT_TAB_TRAVERSAL ) 01793 { 01794 wxWindow* parent = GetParent(); 01795 parent->SetWindowStyle( parent->GetWindowStyle() | wxTAB_TRAVERSAL ); 01796 m_iFlags &= ~(wxCC_IFLAG_PARENT_TAB_TRAVERSAL); 01797 } 01798 01799 // refresh control (necessary even if m_text) 01800 Refresh(); 01801 01802 #if !wxUSE_POPUPWIN 01803 SetFocus(); 01804 #endif 01805 01806 }
|
|
Implemented in wxGenericComboControl. |
|
Definition at line 988 of file combo.cpp. 00989 { 00990 if ( !IsCreated() ) 00991 return; 00992 00993 // defined by actual wxComboCtrls 00994 OnResize(); 00995 00996 event.Skip(); 00997 }
|
|
|
|
Definition at line 1263 of file combo.cpp. 01264 { 01265 // Change event id, object and string before relaying it forward 01266 event.SetId(GetId()); 01267 wxString s = event.GetString(); 01268 event.SetEventObject(this); 01269 event.SetString(s); 01270 event.Skip(); 01271 }
|
|
Definition at line 745 of file combo.cpp.
|
|
Definition at line 1982 of file combo.cpp.
|
|
Definition at line 899 of file combo.cpp. 00900 { 00901 if ( !m_text ) 00902 return; 00903 00904 wxSize sz = GetClientSize(); 00905 int customBorder = m_widthCustomBorder; 00906 00907 if ( (m_text->GetWindowStyleFlag() & wxBORDER_MASK) == wxNO_BORDER ) 00908 { 00909 // Centre textctrl 00910 int tcSizeY = m_text->GetBestSize().y; 00911 int diff = sz.y - tcSizeY; 00912 int y = textCtrlYAdjust + (diff/2); 00913 00914 if ( y < customBorder ) 00915 y = customBorder; 00916 00917 m_text->SetSize( m_tcArea.x + m_widthCustomPaint + m_absIndent + textCtrlXAdjust, 00918 y, 00919 m_tcArea.width - COMBO_MARGIN - 00920 (textCtrlXAdjust + m_widthCustomPaint + m_absIndent), 00921 -1 ); 00922 00923 // Make sure textctrl doesn't exceed the bottom custom border 00924 wxSize tsz = m_text->GetSize(); 00925 diff = (y + tsz.y) - (sz.y - customBorder); 00926 if ( diff >= 0 ) 00927 { 00928 tsz.y = tsz.y - diff - 1; 00929 m_text->SetSize(tsz); 00930 } 00931 } 00932 else 00933 { 00934 m_text->SetSize( m_tcArea.x, 00935 0, 00936 sz.x - m_btnArea.x - m_widthCustomPaint - customBorder, 00937 sz.y ); 00938 } 00939 }
|
|
(handlerFlags & wxCC_MF_ON_BUTTON) ) Definition at line 1365 of file combo.cpp. 01367 { 01368 wxLongLong t = ::wxGetLocalTimeMillis(); 01369 int evtType = event.GetEventType(); 01370 01371 // 01372 // Generate our own double-clicks 01373 // (to allow on-focus dc-event on double-clicks instead of triple-clicks) 01374 if ( (m_windowStyle & wxCC_SPECIAL_DCLICK) && 01375 !m_isPopupShown && 01377 !(flags & wxCC_MF_ON_BUTTON) ) 01378 { 01379 if ( evtType == wxEVT_LEFT_DOWN ) 01380 { 01381 // Set value to avoid up-events without corresponding downs 01382 m_downReceived = true; 01383 } 01384 else if ( evtType == wxEVT_LEFT_DCLICK ) 01385 { 01386 // We'll make our own double-clicks 01387 //evtType = 0; 01388 event.SetEventType(0); 01389 return true; 01390 } 01391 else if ( evtType == wxEVT_LEFT_UP ) 01392 { 01393 if ( m_downReceived || m_timeLastMouseUp == 1 ) 01394 { 01395 wxLongLong timeFromLastUp = (t-m_timeLastMouseUp); 01396 01397 if ( timeFromLastUp < DOUBLE_CLICK_CONVERSION_TRESHOLD ) 01398 { 01399 //type = wxEVT_LEFT_DCLICK; 01400 event.SetEventType(wxEVT_LEFT_DCLICK); 01401 m_timeLastMouseUp = 1; 01402 } 01403 else 01404 { 01405 m_timeLastMouseUp = t; 01406 } 01407 01408 //m_downReceived = false; 01409 } 01410 } 01411 } 01412 01413 // Filter out clicks on button immediately after popup dismiss (Windows like behaviour) 01414 if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick ) 01415 { 01416 event.SetEventType(0); 01417 return true; 01418 } 01419 01420 return false; 01421 }
|
|
Definition at line 1236 of file combo.cpp. 01237 { 01238 if ( IsCreated() ) 01239 { 01240 wxSizeEvent evt(GetSize(),GetId()); 01241 GetEventHandler()->ProcessEvent(evt); 01242 Refresh(); 01243 } 01244 }
|
|
Definition at line 2022 of file combo.cpp. 02023 { 02024 if ( m_text ) 02025 m_text->Remove(from, to); 02026 }
|
|
Definition at line 2016 of file combo.cpp. 02017 { 02018 if ( m_text ) 02019 m_text->Replace(from, to, value); 02020 }
|
|
Definition at line 1861 of file combo.cpp. 01866 { 01867 m_bmpNormal = bmpNormal; 01868 m_blankButtonBg = blankButtonBg; 01869 01870 if ( bmpPressed.Ok() ) 01871 m_bmpPressed = bmpPressed; 01872 else 01873 m_bmpPressed = bmpNormal; 01874 01875 if ( bmpHover.Ok() ) 01876 m_bmpHover = bmpHover; 01877 else 01878 m_bmpHover = bmpNormal; 01879 01880 if ( bmpDisabled.Ok() ) 01881 m_bmpDisabled = bmpDisabled; 01882 else 01883 m_bmpDisabled = bmpNormal; 01884 01885 RecalcAndRefresh(); 01886 }
|
|
Definition at line 1831 of file combo.cpp. 01833 { 01834 m_btnWid = width; 01835 m_btnHei = height; 01836 m_btnSide = side; 01837 m_btnSpacingX = spacingX; 01838 01839 RecalcAndRefresh(); 01840 }
|
|
Definition at line 1888 of file combo.cpp. 01889 { 01890 if ( m_text ) 01891 { 01892 // move textctrl accordingly 01893 wxRect r = m_text->GetRect(); 01894 int inc = width - m_widthCustomPaint; 01895 r.x += inc; 01896 r.width -= inc; 01897 m_text->SetSize( r ); 01898 } 01899 01900 m_widthCustomPaint = width; 01901 01902 RecalcAndRefresh(); 01903 }
|
|
Definition at line 1030 of file combo.cpp. 01031 { 01032 if ( !wxControl::SetFont(font) ) 01033 return false; 01034 01035 if (m_text) 01036 m_text->SetFont(font); 01037 01038 return true; 01039 }
|
|
Definition at line 1988 of file combo.cpp.
|
|
Definition at line 1994 of file combo.cpp.
|
|
Definition at line 250 of file combo.h. 00251 { 00252 m_anchorSide = anchorSide; 00253 }
|
|
Definition at line 160 of file combo.h. 00161 { 00162 DoSetPopupControl(popup); 00163 }
|
|
Definition at line 234 of file combo.h. 00235 { 00236 m_extLeft = extLeft; 00237 m_extRight = extRight; 00238 }
|
|
Definition at line 224 of file combo.h. 00225 { 00226 m_heightPopup = height; 00227 }
|
|
Definition at line 215 of file combo.h. 00216 { 00217 m_widthMinPopup = width; 00218 }
|
|
Reimplemented in wxOwnerDrawnComboBox. Definition at line 2028 of file combo.cpp. 02029 { 02030 if ( m_text ) 02031 m_text->SetSelection(from, to); 02032 }
|
|
Definition at line 1959 of file combo.cpp. 01960 { 01961 // Unlike in SetValue(), this must be called here or 01962 // the behaviour will no be consistent in readonlys. 01963 EnsurePopupControl(); 01964 01965 m_valueString = value; 01966 01967 Refresh(); 01968 }
|
|
Definition at line 1905 of file combo.cpp. 01906 { 01907 if ( indent < 0 ) 01908 { 01909 m_absIndent = GetNativeTextIndent(); 01910 m_iFlags &= ~(wxCC_IFLAG_INDENT_SET); 01911 } 01912 else 01913 { 01914 m_absIndent = indent; 01915 m_iFlags |= wxCC_IFLAG_INDENT_SET; 01916 } 01917 01918 RecalcAndRefresh(); 01919 }
|
|
Definition at line 1937 of file combo.cpp. 01938 { 01939 if ( m_text ) 01940 { 01941 m_text->SetValue(value); 01942 if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) 01943 m_text->SelectAll(); 01944 } 01945 01946 m_valueString = value; 01947 01948 Refresh(); 01949 01950 // Since wxComboPopup may want to paint the combo as well, we need 01951 // to set the string value here (as well as sometimes in ShowPopup). 01952 if ( m_valueString != value && m_popupInterface ) 01953 { 01954 m_popupInterface->SetStringValue(value); 01955 } 01956 }
|
|
Definition at line 316 of file combo.h. 00317 { 00318 const wxWindow* curFocus = FindFocus(); 00319 return ( !m_isPopupShown && 00320 (curFocus == this || (m_btn && curFocus == m_btn)) && 00321 (m_windowStyle & wxCB_READONLY) ); 00322 }
|
|
Definition at line 1016 of file combo.cpp. 01017 { 01018 if ( !wxControl::Show(show) ) 01019 return false; 01020 01021 if (m_btn) 01022 m_btn->Show(show); 01023 01024 if (m_text) 01025 m_text->Show(show); 01026 01027 return true; 01028 }
|
|
Definition at line 1585 of file combo.cpp. 01586 { 01587 EnsurePopupControl(); 01588 wxCHECK_RET( !IsPopupShown(), wxT("popup window already shown") ); 01589 01590 SetFocus(); 01591 01592 // Space above and below 01593 int screenHeight; 01594 wxPoint scrPos; 01595 int spaceAbove; 01596 int spaceBelow; 01597 int maxHeightPopup; 01598 wxSize ctrlSz = GetSize(); 01599 01600 screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); 01601 scrPos = GetParent()->ClientToScreen(GetPosition()); 01602 01603 spaceAbove = scrPos.y; 01604 spaceBelow = screenHeight - spaceAbove - ctrlSz.y; 01605 01606 maxHeightPopup = spaceBelow; 01607 if ( spaceAbove > spaceBelow ) 01608 maxHeightPopup = spaceAbove; 01609 01610 // Width 01611 int widthPopup = ctrlSz.x + m_extLeft + m_extRight; 01612 01613 if ( widthPopup < m_widthMinPopup ) 01614 widthPopup = m_widthMinPopup; 01615 01616 wxWindow* winPopup = m_winPopup; 01617 wxWindow* popup; 01618 01619 // Need to disable tab traversal of parent 01620 // 01621 // NB: This is to fix a bug in wxMSW. In theory it could also be fixed 01622 // by, for instance, adding check to window.cpp:wxWindowMSW::MSWProcessMessage 01623 // that if transient popup is open, then tab traversal is to be ignored. 01624 // However, I think this code would still be needed for cases where 01625 // transient popup doesn't work yet (wxWinCE?). 01626 wxWindow* parent = GetParent(); 01627 int parentFlags = parent->GetWindowStyle(); 01628 if ( parentFlags & wxTAB_TRAVERSAL ) 01629 { 01630 parent->SetWindowStyle( parentFlags & ~(wxTAB_TRAVERSAL) ); 01631 m_iFlags |= wxCC_IFLAG_PARENT_TAB_TRAVERSAL; 01632 } 01633 01634 if ( !winPopup ) 01635 { 01636 CreatePopup(); 01637 winPopup = m_winPopup; 01638 popup = m_popup; 01639 } 01640 else 01641 { 01642 popup = m_popup; 01643 } 01644 01645 wxASSERT( !m_popup || m_popup == popup ); // Consistency check. 01646 01647 wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup, 01648 m_heightPopup<=0?DEFAULT_POPUP_HEIGHT:m_heightPopup, 01649 maxHeightPopup); 01650 01651 popup->SetSize(adjustedSize); 01652 popup->Move(0,0); 01653 m_popupInterface->OnPopup(); 01654 01655 // 01656 // Reposition and resize popup window 01657 // 01658 01659 wxSize szp = popup->GetSize(); 01660 01661 int popupX; 01662 int popupY = scrPos.y + ctrlSz.y; 01663 01664 // Default anchor is wxLEFT 01665 int anchorSide = m_anchorSide; 01666 if ( !anchorSide ) 01667 anchorSide = wxLEFT; 01668 01669 int rightX = scrPos.x + ctrlSz.x + m_extRight - szp.x; 01670 int leftX = scrPos.x - m_extLeft; 01671 int screenWidth = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ); 01672 01673 // If there is not enough horizontal space, anchor on the other side. 01674 // If there is no space even then, place the popup at x 0. 01675 if ( anchorSide == wxRIGHT ) 01676 { 01677 if ( rightX < 0 ) 01678 { 01679 if ( (leftX+szp.x) < screenWidth ) 01680 anchorSide = wxLEFT; 01681 else 01682 anchorSide = 0; 01683 } 01684 } 01685 else 01686 { 01687 if ( (leftX+szp.x) >= screenWidth ) 01688 { 01689 if ( rightX >= 0 ) 01690 anchorSide = wxRIGHT; 01691 else 01692 anchorSide = 0; 01693 } 01694 } 01695 01696 // Select x coordinate according to the anchor side 01697 if ( anchorSide == wxRIGHT ) 01698 popupX = rightX; 01699 else if ( anchorSide == wxLEFT ) 01700 popupX = leftX; 01701 else 01702 popupX = 0; 01703 01704 if ( spaceBelow < szp.y ) 01705 { 01706 popupY = scrPos.y - szp.y; 01707 } 01708 01709 // Move to position 01710 //wxLogDebug(wxT("popup scheduled position1: %i,%i"),ptp.x,ptp.y); 01711 //wxLogDebug(wxT("popup position1: %i,%i"),winPopup->GetPosition().x,winPopup->GetPosition().y); 01712 01713 // Some platforms (GTK) may need these two to be separate 01714 winPopup->SetSize( szp.x, szp.y ); 01715 winPopup->Move( popupX, popupY ); 01716 01717 //wxLogDebug(wxT("popup position2: %i,%i"),winPopup->GetPosition().x,winPopup->GetPosition().y); 01718 01719 m_popup = popup; 01720 01721 // Set string selection (must be this way instead of SetStringSelection) 01722 if ( m_text ) 01723 { 01724 if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) 01725 m_text->SelectAll(); 01726 01727 m_popupInterface->SetStringValue( m_text->GetValue() ); 01728 } 01729 else 01730 { 01731 // This is neede since focus/selection indication may change when popup is shown 01732 Refresh(); 01733 } 01734 01735 // This must be after SetStringValue 01736 m_isPopupShown = true; 01737 01738 // Show it 01739 #if USE_TRANSIENT_POPUP 01740 ((wxPopupTransientWindow*)winPopup)->Popup(popup); 01741 #else 01742 winPopup->Show(); 01743 #endif 01744 01745 #if INSTALL_TOPLEV_HANDLER 01746 // Put top level window event handler into place 01747 if ( !m_toplevEvtHandler ) 01748 m_toplevEvtHandler = new wxComboFrameEventHandler(this); 01749 01750 wxWindow* toplev = ::wxGetTopLevelParent( this ); 01751 wxASSERT( toplev ); 01752 ((wxComboFrameEventHandler*)m_toplevEvtHandler)->OnPopup(); 01753 toplev->PushEventHandler( m_toplevEvtHandler ); 01754 #endif 01755 01756 }
|
|
Definition at line 2034 of file combo.cpp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|