X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/788722ac5ca55bd3c0d1f9bd2d598f90b3b02071..2fe212b0336512aac9eace69fab09ce856b0bf4b:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 50612f6153..6c9206a796 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_CHOICE + #ifndef WX_PRECOMP #include "wx/choice.h" #include "wx/utils.h" @@ -38,7 +40,7 @@ #include "wx/msw/private.h" - IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) // ============================================================================ // implementation @@ -64,6 +66,10 @@ bool wxChoice::Create(wxWindow *parent, if ( style & wxCB_SORT ) msStyle |= CBS_SORT; + if ( style & wxCLIP_SIBLINGS ) + msStyle |= WS_CLIPSIBLINGS; + + // Experience shows that wxChoice vs. wxComboBox distinction confuses // quite a few people - try to help them wxASSERT_MSG( !(style & wxCB_DROPDOWN) && @@ -250,6 +256,24 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const // wxMSW specific helpers // ---------------------------------------------------------------------------- +void wxChoice::DoMoveWindow(int x, int y, int width, int height) +{ + // here is why this is necessary: if the width is negative, the combobox + // window proc makes the window of the size width*height instead of + // interpreting height in the usual manner (meaning the height of the drop + // down list - usually the height specified in the call to MoveWindow() + // will not change the height of combo box per se) + // + // this behaviour is not documented anywhere, but this is just how it is + // here (NT 4.4) and, anyhow, the check shouldn't hurt - however without + // the check, constraints/sizers using combos may break the height + // constraint will have not at all the same value as expected + if ( width < 0 ) + return; + + wxControl::DoMoveWindow(x, y, width, height); +} + void wxChoice::DoSetSize(int x, int y, int width, int WXUNUSED(height), int sizeFlags) @@ -377,4 +401,4 @@ WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED( return (WXHBRUSH)brush->GetResourceHandle(); } - +#endif // wxUSE_CHOICE