Fixes and other changes to the demo and some library modules so they

work better (or at all) on wxMac


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-08-13 23:59:08 +00:00
parent c50c32efd1
commit eb0f373c99
17 changed files with 133 additions and 61 deletions

View File

@@ -159,8 +159,13 @@ class wxGenButton(wxPyControl):
highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT)
self.shadowPen = wxPen(shadowClr, 1, wxSOLID)
self.highlightPen = wxPen(highlightClr, 1, wxSOLID)
self.focusIndPen = wxPen(textClr, 1, wxUSER_DASH)
##self.focusIndPen = wxPen(textClr, 1, wxDOT)
if wxPlatform == "__WXMAC__":
self.focusIndPen = wxPen(textClr, 1, wxSOLID)
else:
self.focusIndPen = wxPen(textClr, 1, wxUSER_DASH)
self.focusIndPen.SetDashes([1,1])
self.focusIndPen.SetCap(wxCAP_BUTT)
self.focusClr = highlightClr
def SetBackgroundColour(self, colour):
@@ -176,6 +181,7 @@ class wxGenButton(wxPyControl):
self.shadowPen = wxPen(wxColour(sr,sg,sb), 1, wxSOLID)
hr, hg, hb = min(255,r+64), min(255,g+64), min(255,b+64)
self.highlightPen = wxPen(wxColour(hr,hg,hb), 1, wxSOLID)
self.focusClr = wxColour(hr, hg, hb)
def _GetLabelSize(self):
@@ -227,15 +233,17 @@ class wxGenButton(wxPyControl):
def DrawFocusIndicator(self, dc, w, h):
bw = self.bezelWidth
if self.hasFocus:
self.focusIndPen.SetColour(self.GetForegroundColour())
else:
self.focusIndPen.SetColour(self.GetBackgroundColour())
self.focusIndPen.SetDashes([1,1])
self.focusIndPen.SetCap(wxCAP_BUTT)
## if self.hasFocus:
## self.focusIndPen.SetColour(self.GetForegroundColour())
## else:
## #self.focusIndPen.SetColour(self.GetBackgroundColour())
## self.focusIndPen.SetColour(self.GetForegroundColour())
self.focusIndPen.SetColour(self.focusClr)
dc.SetLogicalFunction(wxINVERT)
dc.SetPen(self.focusIndPen)
dc.SetBrush(wxTRANSPARENT_BRUSH)
dc.DrawRectangle(bw+2,bw+2, w-bw*2-4, h-bw*2-4)
dc.SetLogicalFunction(wxCOPY)
def OnPaint(self, event):

View File

@@ -158,12 +158,13 @@ class wxEditor(wxScrolledWindow):
def UpdateView(self, dc = None):
if not dc:
if dc is None:
dc = wxClientDC(self)
self.SetCharDimensions()
self.KeepCursorOnScreen()
self.DrawSimpleCursor(0,0,dc, true)
self.Draw(dc)
if dc.Ok():
self.SetCharDimensions()
self.KeepCursorOnScreen()
self.DrawSimpleCursor(0,0,dc, true)
self.Draw(dc)
def OnPaint(self, event):
dc = wxPaintDC(self)
@@ -188,9 +189,7 @@ class wxEditor(wxScrolledWindow):
self.selectColor = wxColour(238, 220, 120) # r, g, b = emacsOrange
def InitDoubleBuffering(self):
bw,bh = self.GetClientSizeTuple()
self.mdc = wxMemoryDC()
self.mdc.SelectObject(wxEmptyBitmap(bw,bh))
pass
def DrawEditText(self, t, x, y, dc):
dc.DrawText(t, x * self.fw, y * self.fh)
@@ -218,19 +217,19 @@ class wxEditor(wxScrolledWindow):
if not odc:
odc = wxClientDC(self)
dc = self.mdc
dc.SetFont(self.font)
dc.SelectObject(wxEmptyBitmap(self.bw,self.bh))
dc.SetBackgroundMode(wxSOLID)
dc.SetTextBackground(self.bgColor)
dc.SetTextForeground(self.fgColor)
dc.Clear()
for line in range(self.sy, self.sy + self.sh):
self.DrawLine(line, dc)
if len(self.lines) < self.sh + self.sy:
self.DrawEofMarker(dc)
odc.Blit(0,0,self.bw,self.bh,dc,0,0,wxCOPY)
self.DrawCursor(odc)
bmp = wxEmptyBitmap(max(1,self.bw), max(1,self.bh))
dc = wxBufferedDC(odc, bmp)
if dc.Ok():
dc.SetFont(self.font)
dc.SetBackgroundMode(wxSOLID)
dc.SetTextBackground(self.bgColor)
dc.SetTextForeground(self.fgColor)
dc.Clear()
for line in range(self.sy, self.sy + self.sh):
self.DrawLine(line, dc)
if len(self.lines) < self.sh + self.sy:
self.DrawEofMarker(dc)
self.DrawCursor(dc)
##------------------ eofMarker stuff