more micro tests

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-02-05 21:53:56 +00:00
parent a8e358c072
commit 04578e2657
2 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import wx
styles = [
('wx.BORDER_DEFAULT', wx.BORDER_DEFAULT),
('wx.BORDER_THEME', wx.BORDER_THEME),
('wx.BORDER_NONE', wx.BORDER_NONE),
('wx.BORDER_STATIC', wx.BORDER_STATIC),
('wx.BORDER_SIMPLE', wx.BORDER_SIMPLE),
('wx.BORDER_RAISED', wx.BORDER_RAISED),
('wx.BORDER_SUNKEN', wx.BORDER_SUNKEN),
('wx.BORDER_DOUBLE', wx.BORDER_DOUBLE),
]
class TestPanel(wx.Panel):
def __init__(self, *args, **kw):
wx.Panel.__init__(self, *args, **kw)
fgs = wx.FlexGridSizer(cols=3, hgap=10, vgap=10)
for name, bdr in styles:
txt = wx.TextCtrl(self, size=(100,-1), style=bdr )#| wx.TE_RICH | wx.TE_MULTILINE)
label = wx.StaticText(self, -1, name)
ctrl = wx.Control(self, -1, style=bdr)
ctrl.SetMinSize(txt.GetSize())
ctrl.SetBackgroundColour("white")
#txt.SetBackgroundColour("pink")
fgs.Add(label)
fgs.Add(ctrl)
fgs.Add(txt)
box = wx.BoxSizer()
box.Add(fgs, 0, wx.ALL, 10)
self.SetSizer(box)
self.Fit()
import wx.lib.mixins.inspect
class TestApp(wx.App, wx.lib.mixins.inspect.InspectionMixin):
pass
app = TestApp(False)
app.Init()
frm = wx.Frame(None, title="border styles")
pnl = TestPanel(frm)
frm.Fit()
frm.Show()
app.MainLoop()

View File

@@ -0,0 +1,49 @@
import wx
import wx.grid
##import os; print os.getpid(); raw_input("press enter...")
class TestFrame(wx.Frame):
def __init__(self, *args, **kw):
wx.Frame.__init__(self, *args, **kw)
self.grid = wx.grid.Grid(self)
self.grid.CreateGrid(10,10)
self.grid.EnableDragCell(True)
self.grid.Bind(wx.grid.EVT_GRID_CELL_BEGIN_DRAG, self.OnBeginDrag)
#self.grid.GetGridWindow().Bind(wx.EVT_MOTION, self.OnMouseDrag)
def OnBeginDrag(self, evt):
print "OnBeginDrag"
# The grid window has the mouse captured when this event is sent??
if self.grid.GetGridWindow().HasCapture():
print "Releasing capture"
self.grid.GetGridWindow().ReleaseMouse()
src = wx.DropSource(self.grid)
data = wx.TextDataObject("This is a test")
src.SetData(data)
result = src.DoDragDrop()
print "result = %d" % result
def OnMouseDrag(self, evt):
if not evt.Dragging():
evt.Skip()
return
print "OnMouseDrag"
src = wx.DropSource(self.grid)
data = wx.TextDataObject("This is a test")
src.SetData(data)
result = src.DoDragDrop()
print "result = %d" % result
from wx.lib.mixins.inspect import InspectableApp
app = InspectableApp(False)
app.Init()
frm = TestFrame(None, title="EVT_GRID_CELL_BEGIN_DRAG")
frm.Show()
app.MainLoop()