diff --git a/docs/changes.txt b/docs/changes.txt index 75dbb047df..394eb63f5d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -383,6 +383,7 @@ All (GUI): - Added wxDC::CopyAttributes() and use it in wxBufferedDC. - Added wxTextWrapper helper class useful for wrapping lines of text. - Added EVT_DATAVIEW_CACHE_HINT() event (Trigve). +- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic). GTK: diff --git a/include/wx/defs.h b/include/wx/defs.h index 28daf3ef1c..639508a86c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1709,9 +1709,10 @@ enum wxBorder #define wxLB_MULTIPLE 0x0040 #define wxLB_EXTENDED 0x0080 /* wxLB_OWNERDRAW is Windows-only */ +#define wxLB_NEEDED_SB 0x0000 #define wxLB_OWNERDRAW 0x0100 -#define wxLB_NEEDED_SB 0x0200 -#define wxLB_ALWAYS_SB 0x0400 +#define wxLB_ALWAYS_SB 0x0200 +#define wxLB_NO_SB 0x0400 #define wxLB_HSCROLL wxHSCROLL /* always show an entire number of rows */ #define wxLB_INT_HEIGHT 0x0800 diff --git a/interface/wx/listbox.h b/interface/wx/listbox.h index fa39ac5dba..14e8af65de 100644 --- a/interface/wx/listbox.h +++ b/interface/wx/listbox.h @@ -39,6 +39,8 @@ Always show a vertical scrollbar. @style{wxLB_NEEDED_SB} Only create a vertical scrollbar if needed. + @style{wxLB_NO_SB} + Don't create vertical scrollbar (wxMSW only). @style{wxLB_SORT} The listbox contents are sorted in alphabetical order. @endStyleTable diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 84634d3088..a06a7af872 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -77,6 +77,7 @@ wxBEGIN_FLAGS( wxListBoxStyle ) wxFLAGS_MEMBER(wxLB_HSCROLL) wxFLAGS_MEMBER(wxLB_ALWAYS_SB) wxFLAGS_MEMBER(wxLB_NEEDED_SB) + wxFLAGS_MEMBER(wxLB_NO_SB) wxFLAGS_MEMBER(wxLB_SORT) wxEND_FLAGS( wxListBoxStyle ) @@ -207,10 +208,6 @@ WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const { WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle); - // always show the vertical scrollbar if necessary -- otherwise it is - // impossible to use the control with the mouse - msStyle |= WS_VSCROLL; - // we always want to get the notifications msStyle |= LBS_NOTIFY; @@ -226,8 +223,16 @@ WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const else if ( style & wxLB_EXTENDED ) msStyle |= LBS_EXTENDEDSEL; - if ( m_windowStyle & wxLB_ALWAYS_SB ) - msStyle |= LBS_DISABLENOSCROLL; + wxASSERT_MSG( !(style & wxLB_ALWAYS_SB) || !(style & wxLB_NO_SB), + _T( "Conflicting styles wxLB_ALWAYS_SB and wxLB_NO_SB." ) ); + + if ( !(style & wxLB_NO_SB) ) + { + msStyle |= WS_VSCROLL; + if ( style & wxLB_ALWAYS_SB ) + msStyle |= LBS_DISABLENOSCROLL; + } + if ( m_windowStyle & wxLB_HSCROLL ) msStyle |= WS_HSCROLL; if ( m_windowStyle & wxLB_SORT )