Use a panel inside the CallTip window so it will be painted right on Mac.

Rip out the antialias font option, it hasn't been needed for a long time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_9_0_BRANCH@60102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2009-04-12 03:01:49 +00:00
parent 940bae519a
commit 7152e1e985
7 changed files with 64 additions and 85 deletions

View File

@@ -3592,13 +3592,8 @@ public:
bool DoDropText(long x, long y, const wxString& data);
#endif
// Specify whether anti-aliased fonts should be used. Will have no effect
// on some platforms, but on some (wxMac for example) can greatly improve
// performance.
void SetUseAntiAliasing(bool useAA);
// Returns the current UseAntiAliasing setting.
bool GetUseAntiAliasing();
void SetUseAntiAliasing(bool WXUNUSED(useAA)) { }
bool GetUseAntiAliasing() { return true; }

View File

@@ -160,7 +160,6 @@ void Font::Create(const char *faceName, int characterSet,
false,
stc2wx(faceName),
encoding);
font->SetNoAntiAliasing(!extraFontFlag);
id = font;
}

View File

@@ -81,6 +81,7 @@ void wxSTCDropTarget::OnLeave() {
}
#endif // wxUSE_DRAG_AND_DROP
//--------------------------------------------------------------------------
#if wxUSE_POPUPWIN
#include "wx/popupwin.h"
@@ -92,35 +93,16 @@ void wxSTCDropTarget::OnLeave() {
#include "wx/dcbuffer.h"
class wxSTCCallTip : public wxSTCCallTipBase {
class wxSTCCallTipContent : public wxPanel {
public:
wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) :
#if wxUSE_POPUPWIN
wxSTCCallTipBase(parent, wxBORDER_NONE),
#else
wxSTCCallTipBase(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxFRAME_NO_TASKBAR
| wxFRAME_FLOAT_ON_PARENT
| wxBORDER_NONE
#ifdef __WXMAC__
| wxPOPUP_WINDOW
#endif
),
#endif
m_ct(ct), m_swx(swx), m_cx(wxDefaultCoord), m_cy(wxDefaultCoord)
wxSTCCallTipContent(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
: wxPanel(parent, -1),
m_ct(ct), m_swx(swx)
{
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
}
~wxSTCCallTip() {
#if wxUSE_POPUPWIN && defined(__WXGTK__)
wxRect rect = GetRect();
rect.x = m_cx;
rect.y = m_cy;
GetParent()->Refresh(false, &rect);
#endif
}
bool AcceptsFocus() const { return false; }
void OnPaint(wxPaintEvent& WXUNUSED(evt))
@@ -135,7 +117,7 @@ public:
void OnFocus(wxFocusEvent& event)
{
GetParent()->SetFocus();
GetGrandParent()->SetFocus();
event.Skip();
}
@@ -147,6 +129,52 @@ public:
m_swx->CallTipClick();
}
private:
CallTip* m_ct;
ScintillaWX* m_swx;
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxSTCCallTipContent, wxPanel)
EVT_PAINT(wxSTCCallTipContent::OnPaint)
EVT_SET_FOCUS(wxSTCCallTipContent::OnFocus)
EVT_LEFT_DOWN(wxSTCCallTipContent::OnLeftDown)
END_EVENT_TABLE()
class wxSTCCallTip : public wxSTCCallTipBase {
public:
wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) :
#if wxUSE_POPUPWIN
wxSTCCallTipBase(parent, wxBORDER_NONE),
#else
wxSTCCallTipBase(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxFRAME_NO_TASKBAR
| wxFRAME_FLOAT_ON_PARENT
| wxBORDER_NONE
#ifdef __WXMAC__
| wxPOPUP_WINDOW
#endif
),
#endif
m_cx(wxDefaultCoord), m_cy(wxDefaultCoord)
{
m_content = new wxSTCCallTipContent(this, ct, swx);
}
~wxSTCCallTip() {
#if wxUSE_POPUPWIN && defined(__WXGTK__)
wxRect rect = GetRect();
rect.x = m_cx;
rect.y = m_cy;
GetParent()->Refresh(false, &rect);
#endif
}
bool AcceptsFocus() const { return false; }
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO)
@@ -161,6 +189,8 @@ public:
GetParent()->ClientToScreen(NULL, &y);
}
wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
m_content->SetSize(0, 0, width, height, sizeFlags);
}
#if wxUSE_POPUPWIN
@@ -187,17 +217,10 @@ public:
}
private:
CallTip* m_ct;
ScintillaWX* m_swx;
int m_cx, m_cy;
DECLARE_EVENT_TABLE()
wxSTCCallTipContent* m_content;
};
BEGIN_EVENT_TABLE(wxSTCCallTip, wxSTCCallTipBase)
EVT_PAINT(wxSTCCallTip::OnPaint)
EVT_SET_FOCUS(wxSTCCallTip::OnFocus)
EVT_LEFT_DOWN(wxSTCCallTip::OnLeftDown)
END_EVENT_TABLE()
//----------------------------------------------------------------------
@@ -252,6 +275,7 @@ ScintillaWX::~ScintillaWX() {
Finalise();
}
//----------------------------------------------------------------------
// base class virtuals
@@ -263,7 +287,6 @@ void ScintillaWX::Initialise() {
dropTarget->SetScintilla(this);
stc->SetDropTarget(dropTarget);
#endif // wxUSE_DRAG_AND_DROP
vs.extraFontFlag = true; // UseAntiAliasing
}
@@ -1097,15 +1120,6 @@ void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect))
}
void ScintillaWX::SetUseAntiAliasing(bool useAA) {
vs.extraFontFlag = useAA;
InvalidateStyleRedraw();
}
bool ScintillaWX::GetUseAntiAliasing() {
return vs.extraFontFlag;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -168,8 +168,6 @@ public:
void DoScrollToLine(int line);
void DoScrollToColumn(int column);
void ClipChildren(wxDC& dc, PRectangle rect);
void SetUseAntiAliasing(bool useAA);
bool GetUseAntiAliasing();
private:
bool capturedMouse;
@@ -193,7 +191,7 @@ private:
int sysCaretHeight;
#endif
friend class wxSTCCallTip;
friend class wxSTCCallTipContent;
};
//----------------------------------------------------------------------

View File

@@ -3580,17 +3580,6 @@ bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
#endif
void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
m_swx->SetUseAntiAliasing(useAA);
}
bool wxStyledTextCtrl::GetUseAntiAliasing() {
return m_swx->GetUseAntiAliasing();
}
void wxStyledTextCtrl::AddTextRaw(const char* text)
{

View File

@@ -589,17 +589,6 @@ bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
#endif
void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
m_swx->SetUseAntiAliasing(useAA);
}
bool wxStyledTextCtrl::GetUseAntiAliasing() {
return m_swx->GetUseAntiAliasing();
}
void wxStyledTextCtrl::AddTextRaw(const char* text)
{

View File

@@ -228,13 +228,8 @@ public:
bool DoDropText(long x, long y, const wxString& data);
#endif
// Specify whether anti-aliased fonts should be used. Will have no effect
// on some platforms, but on some (wxMac for example) can greatly improve
// performance.
void SetUseAntiAliasing(bool useAA);
// Returns the current UseAntiAliasing setting.
bool GetUseAntiAliasing();
void SetUseAntiAliasing(bool WXUNUSED(useAA)) { }
bool GetUseAntiAliasing() { return true; }