#include "wx/imaglist.h"
#include "wx/listctrl.h"
-#ifdef __WXGTK__
+#if defined(__WXGTK__)
#include <gtk/gtk.h>
#include "wx/gtk/win_gtk.h"
#endif
#ifdef __WXMAC__
return *wxWHITE;
#else
- return wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT);
+ return wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT);
#endif
}
wxColour colText;
if ( highlighted )
{
- colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+ colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
}
else
{
m_owner = owner;
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
- SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) );
+ SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
}
wxListHeaderWindow::~wxListHeaderWindow()
void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
{
-#ifdef __WXGTK__
+#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
GtkStateType state = m_parent->IsEnabled() ? GTK_STATE_NORMAL
: GTK_STATE_INSENSITIVE;
gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window,
state, GTK_SHADOW_OUT,
- (GdkRectangle*) NULL, m_wxwindow, "button",
+ (GdkRectangle*) NULL, m_wxwindow,
+ (char *)"button", // const_cast
x-1, y-1, w+2, h+2);
#elif defined( __WXMAC__ )
const int m_corner = 1;
dc->SetBrush( *wxTRANSPARENT_BRUSH );
- dc->SetPen( wxPen( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNSHADOW ) , 1 , wxSOLID ) );
+ dc->SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ) , 1 , wxSOLID ) );
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
- wxPen pen( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID );
+ wxPen pen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID );
dc->SetPen( pen );
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
-#ifdef __WXGTK__
+#if defined(__WXGTK__)
wxClientDC dc( this );
#else
wxPaintDC dc( this );
{
int x1 = m_currentX;
int y1 = 0;
- ClientToScreen( &x1, &y1 );
+ m_owner->ClientToScreen( &x1, &y1 );
- int x2 = m_currentX-1;
+ int x2 = m_currentX;
int y2 = 0;
m_owner->GetClientSize( NULL, &y2 );
m_owner->ClientToScreen( &x2, &y2 );
m_highlightBrush = new wxBrush
(
- wxSystemSettings::GetSystemColour
+ wxSystemSettings::GetColour
(
wxSYS_COLOUR_HIGHLIGHT
),
m_highlightUnfocusedBrush = new wxBrush
(
- wxSystemSettings::GetSystemColour
+ wxSystemSettings::GetColour
(
wxSYS_COLOUR_BTNSHADOW
),
InitScrolling();
SetScrollbars( m_xScroll, m_yScroll, 0, 0, 0, 0 );
- SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) );
+ SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
}
wxListMainWindow::~wxListMainWindow()
for (int tries = 0; tries < 2; tries++)
{
- entireWidth = 0;
+ // We start with 4 for the border around all items
+ entireWidth = 4;
+
+ if (tries == 1)
+ {
+ // Now we have decided that the items do not fit into the
+ // client area. Unfortunately, wxWindows sometimes thinks
+ // that it does fit and therefore NO horizontal scrollbar
+ // is inserted. This looks ugly, so we fudge here and make
+ // the calculated width bigger than was actually has been
+ // calculated. This ensures that wxScrolledWindows puts
+ // a scrollbar at the bottom of its client area.
+ entireWidth += SCROLL_UNIT_X;
+ }
// Start at 2,2 so the text does not touch the border
int x = 2;
currentlyVisibleLines++;
wxListLineData *line = GetLine(i);
line->CalculateSize( &dc, iconSpacing );
- line->SetPosition( x, y, clientWidth, iconSpacing ); // why clientWidth (FIXME)
+ line->SetPosition( x, y, clientWidth, iconSpacing ); // Why clientWidth? (FIXME)
wxSize sizeLine = GetLineSize(i);
if (currentlyVisibleLines > m_linesPerPage)
m_linesPerPage = currentlyVisibleLines;
- // assume that the size of the next one is the same... (FIXME)
+ // Assume that the size of the next one is the same... (FIXME)
if ( y + sizeLine.y >= clientHeight )
{
currentlyVisibleLines = 0;
entireWidth += maxWidth+6;
maxWidth = 0;
}
+
+ // We have reached the last item.
if ( i == count - 1 )
entireWidth += maxWidth;
- if ((tries == 0) && (entireWidth > clientWidth))
+
+ if ( (tries == 0) && (entireWidth+SCROLL_UNIT_X > clientWidth) )
{
- clientHeight -= 15; // guessed scrollbar height (FIXME)
+ clientHeight -= 15; // We guess the scrollbar height. (FIXME)
m_linesPerPage = 0;
currentlyVisibleLines = 0;
break;
}
+
if ( i == count - 1 )
- tries = 1; // everything fits, no second try required
+ tries = 1; // Everything fits, no second try required.
}
}