Font fixes and icons in report view for list control
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4,9 +4,6 @@
|
|||||||
wxTreeCtrl
|
wxTreeCtrl
|
||||||
-> Make it compile. Keyboard handling, icon support.
|
-> Make it compile. Keyboard handling, icon support.
|
||||||
|
|
||||||
wxListCtrl
|
|
||||||
-> Icon support in list mode
|
|
||||||
|
|
||||||
wxClipboard
|
wxClipboard
|
||||||
-> Urgh.
|
-> Urgh.
|
||||||
|
|
||||||
|
@@ -435,7 +435,6 @@ class wxListMainWindow: public wxScrolledWindow
|
|||||||
int m_visibleLines;
|
int m_visibleLines;
|
||||||
wxBrush *m_hilightBrush;
|
wxBrush *m_hilightBrush;
|
||||||
wxColour *m_hilightColour;
|
wxColour *m_hilightColour;
|
||||||
wxFont *m_myFont;
|
|
||||||
int m_xScroll,m_yScroll;
|
int m_xScroll,m_yScroll;
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
wxImageList *m_small_image_list;
|
wxImageList *m_small_image_list;
|
||||||
@@ -479,7 +478,6 @@ class wxListMainWindow: public wxScrolledWindow
|
|||||||
void OnSetFocus( wxFocusEvent &event );
|
void OnSetFocus( wxFocusEvent &event );
|
||||||
void OnKillFocus( wxFocusEvent &event );
|
void OnKillFocus( wxFocusEvent &event );
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
wxFont *GetMyFont( void );
|
|
||||||
void DrawImage( int index, wxPaintDC *dc, int x, int y );
|
void DrawImage( int index, wxPaintDC *dc, int x, int y );
|
||||||
void GetImageSize( int index, int &width, int &height );
|
void GetImageSize( int index, int &width, int &height );
|
||||||
int GetIndexOfLine( const wxListLineData *line );
|
int GetIndexOfLine( const wxListLineData *line );
|
||||||
@@ -606,6 +604,10 @@ class wxListCtrl: public wxControl
|
|||||||
|
|
||||||
// We have to hand down a few functions
|
// We have to hand down a few functions
|
||||||
|
|
||||||
|
void SetBackgroundColour( const wxColour &colour );
|
||||||
|
void SetForegroundColour( const wxColour &colour );
|
||||||
|
void SetFont( const wxFont &font );
|
||||||
|
|
||||||
void SetDropTarget( wxDropTarget *dropTarget )
|
void SetDropTarget( wxDropTarget *dropTarget )
|
||||||
{ m_mainWin->SetDropTarget( dropTarget ); }
|
{ m_mainWin->SetDropTarget( dropTarget ); }
|
||||||
wxDropTarget *GetDropTarget() const
|
wxDropTarget *GetDropTarget() const
|
||||||
@@ -614,12 +616,8 @@ class wxListCtrl: public wxControl
|
|||||||
{ m_mainWin->SetCursor( cursor); }
|
{ m_mainWin->SetCursor( cursor); }
|
||||||
wxColour GetBackgroundColour() const
|
wxColour GetBackgroundColour() const
|
||||||
{ return m_mainWin->GetBackgroundColour(); }
|
{ return m_mainWin->GetBackgroundColour(); }
|
||||||
void SetBackgroundColour( const wxColour &colour )
|
|
||||||
{ m_mainWin->SetBackgroundColour( colour ); }
|
|
||||||
wxColour GetForegroundColour() const
|
wxColour GetForegroundColour() const
|
||||||
{ return m_mainWin->GetForegroundColour(); }
|
{ return m_mainWin->GetForegroundColour(); }
|
||||||
void SetForegroundColour( const wxColour &colour )
|
|
||||||
{ m_mainWin->SetForegroundColour( colour ); }
|
|
||||||
bool PopupMenu( wxMenu *menu, int x, int y )
|
bool PopupMenu( wxMenu *menu, int x, int y )
|
||||||
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
||||||
|
|
||||||
|
@@ -537,14 +537,25 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
|
|||||||
wxNode *node = m_items.First();
|
wxNode *node = m_items.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListItemData *info = (wxListItemData*)node->Data();
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
dc->SetClippingRegion( info->GetX(), info->GetY(), info->GetWidth()-3, info->GetHeight() );
|
dc->SetClippingRegion( item->GetX(), item->GetY(), item->GetWidth()-3, item->GetHeight() );
|
||||||
info->GetText( s );
|
int x = item->GetX();
|
||||||
|
if (item->HasImage())
|
||||||
|
{
|
||||||
|
int y = 0;
|
||||||
|
m_owner->DrawImage( item->GetImage(), dc, x, item->GetY() );
|
||||||
|
m_owner->GetImageSize( item->GetImage(), x, y );
|
||||||
|
x += item->GetX() + 5;
|
||||||
|
}
|
||||||
|
if (item->HasText())
|
||||||
|
{
|
||||||
|
item->GetText( s );
|
||||||
if (hilight)
|
if (hilight)
|
||||||
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||||
else
|
else
|
||||||
dc->SetTextForeground( * info->GetColour() );
|
dc->SetTextForeground( *item->GetColour() );
|
||||||
dc->DrawText( s, info->GetX()+2, info->GetY() );
|
dc->DrawText( s, x, item->GetY() );
|
||||||
|
}
|
||||||
dc->DestroyClippingRegion();
|
dc->DestroyClippingRegion();
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -693,7 +704,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
dc.BeginDrawing();
|
dc.BeginDrawing();
|
||||||
|
|
||||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) );
|
dc.SetFont( m_font );
|
||||||
|
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
@@ -702,6 +713,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
GetClientSize( &w, &h );
|
GetClientSize( &w, &h );
|
||||||
|
|
||||||
dc.SetTextForeground( *wxBLACK );
|
dc.SetTextForeground( *wxBLACK );
|
||||||
|
if (m_foregroundColour.Ok()) dc.SetTextForeground( m_foregroundColour );
|
||||||
|
|
||||||
x = 1;
|
x = 1;
|
||||||
y = 1;
|
y = 1;
|
||||||
@@ -758,7 +770,6 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||||||
{
|
{
|
||||||
// wxScreenDC::EndDrawingOnTop();
|
// wxScreenDC::EndDrawingOnTop();
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
wxYield(); // for debugging
|
|
||||||
m_isDraging = FALSE;
|
m_isDraging = FALSE;
|
||||||
m_owner->SetColumnWidth( m_column, m_currentX-m_minX );
|
m_owner->SetColumnWidth( m_column, m_currentX-m_minX );
|
||||||
}
|
}
|
||||||
@@ -911,7 +922,6 @@ wxListMainWindow::wxListMainWindow( void )
|
|||||||
m_current = (wxListLineData *) NULL;
|
m_current = (wxListLineData *) NULL;
|
||||||
m_visibleLines = 0;
|
m_visibleLines = 0;
|
||||||
m_hilightBrush = (wxBrush *) NULL;
|
m_hilightBrush = (wxBrush *) NULL;
|
||||||
m_myFont = (wxFont *) NULL;
|
|
||||||
m_xScroll = 0;
|
m_xScroll = 0;
|
||||||
m_yScroll = 0;
|
m_yScroll = 0;
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
@@ -944,7 +954,6 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
|||||||
m_small_spacing = 30;
|
m_small_spacing = 30;
|
||||||
m_normal_spacing = 40;
|
m_normal_spacing = 40;
|
||||||
// AllowDoubleClick( TRUE );
|
// AllowDoubleClick( TRUE );
|
||||||
m_myFont = wxNORMAL_FONT;
|
|
||||||
m_hasFocus = FALSE;
|
m_hasFocus = FALSE;
|
||||||
m_dragCount = 0;
|
m_dragCount = 0;
|
||||||
m_isCreated = FALSE;
|
m_isCreated = FALSE;
|
||||||
@@ -978,7 +987,6 @@ wxListMainWindow::~wxListMainWindow( void )
|
|||||||
if (m_hilightBrush) delete m_hilightBrush;
|
if (m_hilightBrush) delete m_hilightBrush;
|
||||||
delete m_renameTimer;
|
delete m_renameTimer;
|
||||||
// if (m_hilightColour) delete m_hilightColour;
|
// if (m_hilightColour) delete m_hilightColour;
|
||||||
// if (m_myFont) delete m_myFont;
|
|
||||||
// delete m_text;
|
// delete m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,8 +1019,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
dc.BeginDrawing();
|
dc.BeginDrawing();
|
||||||
|
|
||||||
// dc.SetFont( *m_myFont );
|
dc.SetFont( m_font );
|
||||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) );
|
|
||||||
|
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -1488,11 +1495,6 @@ void wxListMainWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFont *wxListMainWindow::GetMyFont( void )
|
|
||||||
{
|
|
||||||
return m_myFont;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y )
|
void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y )
|
||||||
{
|
{
|
||||||
if ((m_mode & wxLC_ICON) && (m_normal_image_list))
|
if ((m_mode & wxLC_ICON) && (m_normal_image_list))
|
||||||
@@ -1504,6 +1506,11 @@ void wxListMainWindow::DrawImage( int index, wxPaintDC *dc, int x, int y )
|
|||||||
{
|
{
|
||||||
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||||
}
|
}
|
||||||
|
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
||||||
|
{
|
||||||
|
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::GetImageSize( int index, int &width, int &height )
|
void wxListMainWindow::GetImageSize( int index, int &width, int &height )
|
||||||
@@ -1518,6 +1525,11 @@ void wxListMainWindow::GetImageSize( int index, int &width, int &height )
|
|||||||
m_small_image_list->GetSize( index, width, height );
|
m_small_image_list->GetSize( index, width, height );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
||||||
|
{
|
||||||
|
m_small_image_list->GetSize( index, width, height );
|
||||||
|
return;
|
||||||
|
}
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
@@ -1832,7 +1844,7 @@ long wxListMainWindow::GetMode( void ) const
|
|||||||
void wxListMainWindow::CalculatePositions( void )
|
void wxListMainWindow::CalculatePositions( void )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) );
|
dc.SetFont( m_font );
|
||||||
|
|
||||||
int iconSpacing = 0;
|
int iconSpacing = 0;
|
||||||
if (m_mode & wxLC_ICON) iconSpacing = m_normal_spacing;
|
if (m_mode & wxLC_ICON) iconSpacing = m_normal_spacing;
|
||||||
@@ -2670,4 +2682,24 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
m_mainWin->Refresh();
|
m_mainWin->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
m_mainWin->SetBackgroundColour( colour );
|
||||||
|
m_headerWin->SetBackgroundColour( colour );
|
||||||
|
m_mainWin->m_dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
m_mainWin->SetForegroundColour( colour );
|
||||||
|
m_headerWin->SetForegroundColour( colour );
|
||||||
|
m_mainWin->m_dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListCtrl::SetFont( const wxFont &font )
|
||||||
|
{
|
||||||
|
m_mainWin->SetFont( font );
|
||||||
|
m_headerWin->SetFont( font );
|
||||||
|
m_mainWin->m_dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user