Provide an implementation for SurfaceImpl::AlphaRectangle, and rename
[G|S]etCaretLineBack git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2157,10 +2157,10 @@ public:
|
|||||||
void SetCaretLineVisible(bool show);
|
void SetCaretLineVisible(bool show);
|
||||||
|
|
||||||
// Get the colour of the background of the line containing the caret.
|
// Get the colour of the background of the line containing the caret.
|
||||||
wxColour GetCaretLineBack();
|
wxColour GetCaretLineBackground();
|
||||||
|
|
||||||
// Set the colour of the background of the line containing the caret.
|
// Set the colour of the background of the line containing the caret.
|
||||||
void SetCaretLineBack(const wxColour& back);
|
void SetCaretLineBackground(const wxColour& back);
|
||||||
|
|
||||||
// Set a style to be changeable or not (read only).
|
// Set a style to be changeable or not (read only).
|
||||||
// Experimental feature, currently buggy.
|
// Experimental feature, currently buggy.
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
#include "wx/rawbmp.h"
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "PlatWX.h"
|
#include "PlatWX.h"
|
||||||
@@ -334,12 +335,73 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
|
|||||||
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
|
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
|
||||||
|
#else
|
||||||
|
#define wxPy_premultiply(p, a) (p)
|
||||||
|
#endif
|
||||||
|
|
||||||
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
||||||
ColourAllocated fill, int alphaFill,
|
ColourAllocated fill, int alphaFill,
|
||||||
ColourAllocated outline, int alphaOutline, int flags) {
|
ColourAllocated outline, int alphaOutline,
|
||||||
// ** TODO
|
int /*flags*/) {
|
||||||
|
int x, y;
|
||||||
|
wxRect r = wxRectFromPRectangle(rc);
|
||||||
|
wxBitmap bmp(r.width, r.height, 32);
|
||||||
|
wxAlphaPixelData pixData(bmp);
|
||||||
|
pixData.UseAlpha();
|
||||||
|
|
||||||
RectangleDraw(rc, outline, fill);
|
// Set the fill pixels
|
||||||
|
ColourDesired cdf(fill.AsLong());
|
||||||
|
int red = cdf.GetRed();
|
||||||
|
int green = cdf.GetGreen();
|
||||||
|
int blue = cdf.GetBlue();
|
||||||
|
|
||||||
|
wxAlphaPixelData::Iterator p(pixData);
|
||||||
|
for (y=0; y<r.height; y++) {
|
||||||
|
p.MoveTo(pixData, 0, y);
|
||||||
|
for (x=0; x<r.width; x++) {
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaFill);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaFill);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaFill);
|
||||||
|
p.Alpha() = alphaFill;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the outline pixels
|
||||||
|
ColourDesired cdo(outline.AsLong());
|
||||||
|
red = cdo.GetRed();
|
||||||
|
green = cdo.GetGreen();
|
||||||
|
blue = cdo.GetBlue();
|
||||||
|
for (x=0; x<r.width; x++) {
|
||||||
|
p.MoveTo(pixData, x, 0);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
p.MoveTo(pixData, x, r.height-1);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y=0; y<r.height; y++) {
|
||||||
|
p.MoveTo(pixData, 0, y);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
p.MoveTo(pixData, r.width-1, y);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the bitmap
|
||||||
|
hdc->DrawBitmap(bmp, r.x, r.y, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
||||||
|
@@ -489,6 +489,8 @@ methodOverrideMap = {
|
|||||||
'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0),
|
'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0),
|
||||||
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
|
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
|
||||||
|
|
||||||
|
'GetCaretLineBack' : ('GetCaretLineBackground', 0, 0, 0),
|
||||||
|
'SetCaretLineBack' : ('SetCaretLineBackground', 0, 0, 0),
|
||||||
|
|
||||||
'ReplaceTarget' :
|
'ReplaceTarget' :
|
||||||
(0,
|
(0,
|
||||||
|
@@ -786,13 +786,13 @@ void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the colour of the background of the line containing the caret.
|
// Get the colour of the background of the line containing the caret.
|
||||||
wxColour wxStyledTextCtrl::GetCaretLineBack() {
|
wxColour wxStyledTextCtrl::GetCaretLineBackground() {
|
||||||
long c = SendMsg(2097, 0, 0);
|
long c = SendMsg(2097, 0, 0);
|
||||||
return wxColourFromLong(c);
|
return wxColourFromLong(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the colour of the background of the line containing the caret.
|
// Set the colour of the background of the line containing the caret.
|
||||||
void wxStyledTextCtrl::SetCaretLineBack(const wxColour& back) {
|
void wxStyledTextCtrl::SetCaretLineBackground(const wxColour& back) {
|
||||||
SendMsg(2098, wxColourAsLong(back), 0);
|
SendMsg(2098, wxColourAsLong(back), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2157,10 +2157,10 @@ public:
|
|||||||
void SetCaretLineVisible(bool show);
|
void SetCaretLineVisible(bool show);
|
||||||
|
|
||||||
// Get the colour of the background of the line containing the caret.
|
// Get the colour of the background of the line containing the caret.
|
||||||
wxColour GetCaretLineBack();
|
wxColour GetCaretLineBackground();
|
||||||
|
|
||||||
// Set the colour of the background of the line containing the caret.
|
// Set the colour of the background of the line containing the caret.
|
||||||
void SetCaretLineBack(const wxColour& back);
|
void SetCaretLineBackground(const wxColour& back);
|
||||||
|
|
||||||
// Set a style to be changeable or not (read only).
|
// Set a style to be changeable or not (read only).
|
||||||
// Experimental feature, currently buggy.
|
// Experimental feature, currently buggy.
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
#include "wx/rawbmp.h"
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "PlatWX.h"
|
#include "PlatWX.h"
|
||||||
@@ -334,12 +335,73 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
|
|||||||
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
|
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
|
||||||
|
#else
|
||||||
|
#define wxPy_premultiply(p, a) (p)
|
||||||
|
#endif
|
||||||
|
|
||||||
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
||||||
ColourAllocated fill, int alphaFill,
|
ColourAllocated fill, int alphaFill,
|
||||||
ColourAllocated outline, int alphaOutline, int flags) {
|
ColourAllocated outline, int alphaOutline,
|
||||||
// ** TODO
|
int /*flags*/) {
|
||||||
|
int x, y;
|
||||||
|
wxRect r = wxRectFromPRectangle(rc);
|
||||||
|
wxBitmap bmp(r.width, r.height, 32);
|
||||||
|
wxAlphaPixelData pixData(bmp);
|
||||||
|
pixData.UseAlpha();
|
||||||
|
|
||||||
RectangleDraw(rc, outline, fill);
|
// Set the fill pixels
|
||||||
|
ColourDesired cdf(fill.AsLong());
|
||||||
|
int red = cdf.GetRed();
|
||||||
|
int green = cdf.GetGreen();
|
||||||
|
int blue = cdf.GetBlue();
|
||||||
|
|
||||||
|
wxAlphaPixelData::Iterator p(pixData);
|
||||||
|
for (y=0; y<r.height; y++) {
|
||||||
|
p.MoveTo(pixData, 0, y);
|
||||||
|
for (x=0; x<r.width; x++) {
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaFill);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaFill);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaFill);
|
||||||
|
p.Alpha() = alphaFill;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the outline pixels
|
||||||
|
ColourDesired cdo(outline.AsLong());
|
||||||
|
red = cdo.GetRed();
|
||||||
|
green = cdo.GetGreen();
|
||||||
|
blue = cdo.GetBlue();
|
||||||
|
for (x=0; x<r.width; x++) {
|
||||||
|
p.MoveTo(pixData, x, 0);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
p.MoveTo(pixData, x, r.height-1);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y=0; y<r.height; y++) {
|
||||||
|
p.MoveTo(pixData, 0, y);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
p.MoveTo(pixData, r.width-1, y);
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
|
p.Alpha() = alphaOutline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the bitmap
|
||||||
|
hdc->DrawBitmap(bmp, r.x, r.y, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
||||||
|
@@ -489,6 +489,8 @@ methodOverrideMap = {
|
|||||||
'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0),
|
'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0),
|
||||||
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
|
'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0),
|
||||||
|
|
||||||
|
'GetCaretLineBack' : ('GetCaretLineBackground', 0, 0, 0),
|
||||||
|
'SetCaretLineBack' : ('SetCaretLineBackground', 0, 0, 0),
|
||||||
|
|
||||||
'ReplaceTarget' :
|
'ReplaceTarget' :
|
||||||
(0,
|
(0,
|
||||||
|
@@ -786,13 +786,13 @@ void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the colour of the background of the line containing the caret.
|
// Get the colour of the background of the line containing the caret.
|
||||||
wxColour wxStyledTextCtrl::GetCaretLineBack() {
|
wxColour wxStyledTextCtrl::GetCaretLineBackground() {
|
||||||
long c = SendMsg(2097, 0, 0);
|
long c = SendMsg(2097, 0, 0);
|
||||||
return wxColourFromLong(c);
|
return wxColourFromLong(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the colour of the background of the line containing the caret.
|
// Set the colour of the background of the line containing the caret.
|
||||||
void wxStyledTextCtrl::SetCaretLineBack(const wxColour& back) {
|
void wxStyledTextCtrl::SetCaretLineBackground(const wxColour& back) {
|
||||||
SendMsg(2098, wxColourAsLong(back), 0);
|
SendMsg(2098, wxColourAsLong(back), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -306,10 +306,10 @@ DocStr(wxStyledTextCtrl::GetCaretLineVisible,
|
|||||||
DocStr(wxStyledTextCtrl::SetCaretLineVisible,
|
DocStr(wxStyledTextCtrl::SetCaretLineVisible,
|
||||||
"Display the background of the line containing the caret in a different colour.", "");
|
"Display the background of the line containing the caret in a different colour.", "");
|
||||||
|
|
||||||
DocStr(wxStyledTextCtrl::GetCaretLineBack,
|
DocStr(wxStyledTextCtrl::GetCaretLineBackground,
|
||||||
"Get the colour of the background of the line containing the caret.", "");
|
"Get the colour of the background of the line containing the caret.", "");
|
||||||
|
|
||||||
DocStr(wxStyledTextCtrl::SetCaretLineBack,
|
DocStr(wxStyledTextCtrl::SetCaretLineBackground,
|
||||||
"Set the colour of the background of the line containing the caret.", "");
|
"Set the colour of the background of the line containing the caret.", "");
|
||||||
|
|
||||||
DocStr(wxStyledTextCtrl::StyleSetChangeable,
|
DocStr(wxStyledTextCtrl::StyleSetChangeable,
|
||||||
|
Reference in New Issue
Block a user