Added DisplayTextPopup to wxHtmlHelpController; fixed refresh bugs in

generic wxListCtrl


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2001-03-02 15:16:16 +00:00
parent d3d6931427
commit 673dfcfac1
3 changed files with 49 additions and 6 deletions

View File

@@ -72,6 +72,8 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
virtual bool DisplaySection(int sectionNo); virtual bool DisplaySection(int sectionNo);
virtual bool DisplaySection(const wxString& section) { return Display(section); } virtual bool DisplaySection(const wxString& section) { return Display(section); }
virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
virtual void SetFrameParameters(const wxString& title, virtual void SetFrameParameters(const wxString& title,
const wxSize& size, const wxSize& size,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,

View File

@@ -1695,6 +1695,10 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxPaintDC dc( this ); wxPaintDC dc( this );
PrepareDC( dc ); PrepareDC( dc );
int dev_x = 0;
int dev_y = 0;
CalcScrolledPosition( 0, 0, &dev_x, &dev_y );
if (m_dirty) return; if (m_dirty) return;
if (m_lines.GetCount() == 0) return; if (m_lines.GetCount() == 0) return;
@@ -1706,9 +1710,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
if (m_mode & wxLC_REPORT) if (m_mode & wxLC_REPORT)
{ {
wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
int lineSpacing = 0; int lineSpacing = 0;
@@ -1727,12 +1728,20 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
m_lines[i].Draw( &dc ); m_lines[i].Draw( &dc );
// Draw horizontal rule if required // Draw horizontal rule if required
if (GetWindowStyle() & wxLC_HRULES) if (GetWindowStyle() & wxLC_HRULES)
dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing); {
dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
dc.DrawLine(0 - dev_x , i*lineSpacing , clientSize.x - dev_x , i*lineSpacing );
}
} }
// Draw last horizontal rule // Draw last horizontal rule
if ((i > (size_t) (y_s / lineSpacing)) && (GetWindowStyle() & wxLC_HRULES)) if ((i > (size_t) (y_s / lineSpacing)) && (GetWindowStyle() & wxLC_HRULES))
dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing); {
dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
dc.DrawLine(0 - dev_x , i*lineSpacing , clientSize.x - dev_x , i*lineSpacing );
}
// Draw vertical rules if required // Draw vertical rules if required
if ((GetWindowStyle() & wxLC_VRULES) && (GetItemCount() > 0)) if ((GetWindowStyle() & wxLC_VRULES) && (GetItemCount() > 0))
@@ -1743,11 +1752,13 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
GetItemRect(0, firstItemRect); GetItemRect(0, firstItemRect);
GetItemRect(GetItemCount() - 1, lastItemRect); GetItemRect(GetItemCount() - 1, lastItemRect);
int x = firstItemRect.GetX(); int x = firstItemRect.GetX();
dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
for (col = 0; col < GetColumnCount(); col++) for (col = 0; col < GetColumnCount(); col++)
{ {
int colWidth = GetColumnWidth(col); int colWidth = GetColumnWidth(col);
x += colWidth ; x += colWidth ;
dc.DrawLine(x, firstItemRect.GetY() - 1, x, lastItemRect.GetBottom() + 1); dc.DrawLine(x - dev_x, firstItemRect.GetY() - 1 - dev_y, x - dev_x, lastItemRect.GetBottom() + 1 - dev_y);
} }
} }
} }

View File

@@ -28,6 +28,10 @@
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/busyinfo.h" #include "wx/busyinfo.h"
#if wxUSE_HELP
#include "wx/tipwin.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase) IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase)
wxHtmlHelpController::wxHtmlHelpController(int style) wxHtmlHelpController::wxHtmlHelpController(int style)
@@ -187,6 +191,32 @@ bool wxHtmlHelpController::DisplaySection(int sectionNo)
return Display(sectionNo); return Display(sectionNo);
} }
bool wxHtmlHelpController::DisplayTextPopup(const wxString& text, const wxPoint& WXUNUSED(pos))
{
#if wxUSE_HELP
static wxTipWindow* s_tipWindow = NULL;
if (s_tipWindow)
{
// Prevent s_tipWindow being nulled in OnIdle,
// thereby removing the chance for the window to be closed by ShowHelp
s_tipWindow->SetTipWindowPtr(NULL);
s_tipWindow->Close();
}
s_tipWindow = NULL;
if ( !text.empty() )
{
s_tipWindow = new wxTipWindow(wxTheApp->GetTopWindow(), text, 100, & s_tipWindow);
return TRUE;
}
return FALSE;
#endif
return FALSE;
}
void wxHtmlHelpController::SetFrameParameters(const wxString& title, void wxHtmlHelpController::SetFrameParameters(const wxString& title,
const wxSize& size, const wxSize& size,
const wxPoint& pos, const wxPoint& pos,