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); bool DoDropText(long x, long y, const wxString& data);
#endif #endif
// Specify whether anti-aliased fonts should be used. Will have no effect void SetUseAntiAliasing(bool WXUNUSED(useAA)) { }
// on some platforms, but on some (wxMac for example) can greatly improve bool GetUseAntiAliasing() { return true; }
// performance.
void SetUseAntiAliasing(bool useAA);
// Returns the current UseAntiAliasing setting.
bool GetUseAntiAliasing();

View File

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

View File

@@ -81,6 +81,7 @@ void wxSTCDropTarget::OnLeave() {
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
//--------------------------------------------------------------------------
#if wxUSE_POPUPWIN #if wxUSE_POPUPWIN
#include "wx/popupwin.h" #include "wx/popupwin.h"
@@ -92,33 +93,14 @@ void wxSTCDropTarget::OnLeave() {
#include "wx/dcbuffer.h" #include "wx/dcbuffer.h"
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_ct(ct), m_swx(swx), m_cx(wxDefaultCoord), m_cy(wxDefaultCoord)
{
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
}
~wxSTCCallTip() { class wxSTCCallTipContent : public wxPanel {
#if wxUSE_POPUPWIN && defined(__WXGTK__) public:
wxRect rect = GetRect(); wxSTCCallTipContent(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
rect.x = m_cx; : wxPanel(parent, -1),
rect.y = m_cy; m_ct(ct), m_swx(swx)
GetParent()->Refresh(false, &rect); {
#endif SetBackgroundStyle(wxBG_STYLE_CUSTOM);
} }
bool AcceptsFocus() const { return false; } bool AcceptsFocus() const { return false; }
@@ -135,7 +117,7 @@ public:
void OnFocus(wxFocusEvent& event) void OnFocus(wxFocusEvent& event)
{ {
GetParent()->SetFocus(); GetGrandParent()->SetFocus();
event.Skip(); event.Skip();
} }
@@ -147,6 +129,52 @@ public:
m_swx->CallTipClick(); 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, virtual void DoSetSize(int x, int y,
int width, int height, int width, int height,
int sizeFlags = wxSIZE_AUTO) int sizeFlags = wxSIZE_AUTO)
@@ -161,6 +189,8 @@ public:
GetParent()->ClientToScreen(NULL, &y); GetParent()->ClientToScreen(NULL, &y);
} }
wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags); wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
m_content->SetSize(0, 0, width, height, sizeFlags);
} }
#if wxUSE_POPUPWIN #if wxUSE_POPUPWIN
@@ -187,17 +217,10 @@ public:
} }
private: private:
CallTip* m_ct;
ScintillaWX* m_swx;
int m_cx, m_cy; 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(); Finalise();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// base class virtuals // base class virtuals
@@ -263,7 +287,6 @@ void ScintillaWX::Initialise() {
dropTarget->SetScintilla(this); dropTarget->SetScintilla(this);
stc->SetDropTarget(dropTarget); stc->SetDropTarget(dropTarget);
#endif // wxUSE_DRAG_AND_DROP #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 DoScrollToLine(int line);
void DoScrollToColumn(int column); void DoScrollToColumn(int column);
void ClipChildren(wxDC& dc, PRectangle rect); void ClipChildren(wxDC& dc, PRectangle rect);
void SetUseAntiAliasing(bool useAA);
bool GetUseAntiAliasing();
private: private:
bool capturedMouse; bool capturedMouse;
@@ -193,7 +191,7 @@ private:
int sysCaretHeight; int sysCaretHeight;
#endif #endif
friend class wxSTCCallTip; friend class wxSTCCallTipContent;
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

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

View File

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

View File

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