]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_renderHeaderButton.py
   5 #import os; print os.getpid(); raw_input("Press enter...") 
   9     def __init__(self
, parent
): 
  10         wx
.Panel
.__init
__(self
, parent
) 
  11         self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
) 
  13     def OnPaint(self
, evt
): 
  15         dc
.SetFont(self
.GetFont()) 
  16         r 
= wx
.RendererNative
.Get() 
  17         rect 
= wx
.Rect(40,10, 95,r
.GetHeaderButtonHeight(self
)) 
  20         # simple helper to make calling DrawHeaderButton so many times a 
  21         # bit easier and less messy 
  22         def dhb(idx
, rect
, flags
=0, sort
=0, params
=None): 
  23             dc
.DrawText("%02d." % idx
, rect
.x
-25, rect
.y
) 
  24             r
.DrawHeaderButton(self
, dc
, rect
, flags
, sort
, params
) 
  28         dhb(2, rect
, wx
.CONTROL_SELECTED
) 
  29         dhb(3, rect
, wx
.CONTROL_CURRENT
) 
  30         dhb(4, rect
, wx
.CONTROL_SELECTED|wx
.CONTROL_CURRENT
) 
  31         dhb(5, rect
, 0, wx
.HDR_SORT_ICON_UP
) 
  32         dhb(6, rect
, 0, wx
.HDR_SORT_ICON_DOWN
) 
  33         dhb(7, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
) 
  34         dhb(8, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_DOWN
) 
  38         hp 
= wx
.HeaderButtonParams() 
  39         hp
.m_labelText 
= "Hello" 
  40         dhb(9, rect
, params
=hp
) 
  41         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  42         dhb(10, rect
, params
=hp
) 
  43         hp
.m_labelAlignment 
= wx
.ALIGN_RIGHT
 
  44         dhb(11, rect
, params
=hp
) 
  45         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  46         dhb(12, rect
, wx
.CONTROL_SELECTED
, 0, hp
) 
  47         dhb(13, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  48         hp
.m_labelText 
= "This label is too long" 
  49         dhb(14, rect
, params
=hp
) 
  50         dhb(15, rect
, wx
.CONTROL_SELECTED
, 0, hp
) 
  51         dhb(16, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  55         hp 
= wx
.HeaderButtonParams() 
  56         hp
.m_labelBitmap 
= getBitmap() 
  57         dhb(17, rect
, params
=hp
) 
  58         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  59         dhb(18, rect
, params
=hp
) 
  60         hp
.m_labelAlignment 
= wx
.ALIGN_RIGHT
 
  61         dhb(19, rect
, params
=hp
) 
  62         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  63         dhb(20, rect
, wx
.CONTROL_SELECTED
, 0, hp
) 
  64         dhb(21, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  67         hp
.m_labelText 
= "label" 
  68         hp
.m_labelAlignment 
= wx
.ALIGN_LEFT
 
  69         dhb(22, rect
, 0, 0, hp
) 
  70         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  71         dhb(23, rect
, 0, 0, hp
) 
  72         hp
.m_labelAlignment 
= wx
.ALIGN_RIGHT
 
  73         dhb(24, rect
, 0, 0, hp
) 
  77         hp
.m_labelAlignment 
= wx
.ALIGN_LEFT
 
  78         dhb(25, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  79         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  80         dhb(26, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  81         hp
.m_labelAlignment 
= wx
.ALIGN_RIGHT
 
  82         dhb(27, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  84         hp
.m_labelText 
= "longer label" 
  85         hp
.m_labelAlignment 
= wx
.ALIGN_LEFT
 
  86         dhb(28, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  87         hp
.m_labelAlignment 
= wx
.ALIGN_CENTER
 
  88         dhb(29, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  89         hp
.m_labelAlignment 
= wx
.ALIGN_RIGHT
 
  90         dhb(30, rect
, wx
.CONTROL_SELECTED
, wx
.HDR_SORT_ICON_UP
, hp
) 
  95 '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ 
  96 \x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\ 
  97 \x00\x01\xceIDAT8\x8d\x95\x93=h\x14A\x14\xc7\x7f\xfbq\xc7m\xce\x0b\xe4\xa2F/\ 
  98 ~\x04\x9b\x03O\x0bE\x10\x04\x91\x10\x88X\xa4J\xe7&\x8a\x10A\xc4Bb\xe9uje\xc0\ 
  99 \xd2\xd2\xca\x94V\xa9\xa3X\x88i\x14\x0b\x91\x14\xae$dO\x8d\x97#\xf1<n/;\xb3k\ 
 100 !;\xd9\xbd\xdd\x14\xfea\x9a7\xef\xff{\x8f7\xf34M7\x88+\x90"d\x1f\xe9\x86\xa9\ 
 101 \xf5\xc7\xcc~\xf3\x8d\x87W\xb9pbR\xc5\xb6\xfc5\x00\xbe}_%\x90"\xec\x87\x98q\ 
 102 \xf3\xfc\xc2,\xf7\xef=\x00\xa0\xc36\x8d\xf0\x03#\x0c\x00p\x9asL?:\x9b\x82\ 
 103 \x98q\xf3\x8c=\xcbr\xf3E\xa2E\xcf\xf7\x01\x90\x81`|\xae\x96\x82\xe8\x81\x14\ 
 104 \xe1\xf4\x9d\te\xf6|_\x9dN\xaf\x8b\x0c\x04\x83\xc6a\xa6F\xef\xe2\xfd\xb0\x18\ 
 105 \x9f\xabq\xf1\xfa\xa8\x9a\x95\x1eUjt\xbf&*\xcb@\x000\x94\xab`W\xeb\x9c?:I^\ 
 106 \xb7\x0084r0{\x88Q\xbb\x91\x8a\xc6\x10v\xb5\xcep\xa1\xc2\xe7\xd6;~\xcbM\xacP\ 
 107 &r\x12\x80\x82V\xe2\xda\xc9\xdb\x1c\x19\x18\xe3\xe5\xeac&\x8e\xcf0\\\xa8\xb0\ 
 108 \xe4<gy\xfd\x159\xd3\xc0\xc2\xe2\xd7\xcf\xa6\xf2\xe8q@^\xb7h\xf56(\xe5\xca\ 
 109 \xd8\xd5:\xb5\xf2%e\xdeO\x89\x0e\xdc\xb6\x83\xdbv\xf8\xb8\xf9\x06\xbbZO\x99}\ 
 110 !\x91\xa1\xc8\x06\xec\xc85\xda\x9d.\xa5\xa2\x85\xdbvx\xf2\xfef"\xd1\xeb\xed\ 
 111 \x02`h\x07\x92\x00\xdd0\xb5@\x8ap\xea\xd6e\xae\xcc\x1f\xa3\xb1\xd5T\xc9\xfd\ 
 112 \x1a;3\xc8\xeb\xa7\x0e+\x8b\xae\xfa\xd6&\xfc\xfb\xe3qHP\xfeCgg\xefEtS\xc3*\ 
 113 \x9a\xbc]Xg\xe9\xd9\'v\xa5\xa7\xee\xb4\xf82E\x90\xfc\xa9\xedT\xf5\x8d/-V\x16\ 
 114 ]\xa2\x82\x99\x80\x08\x92\xd9?\xd9\xdb\x98\x02\xfc\xaf\xfe\x02\xb1S\xd1)\xa5\ 
 115 \x1a\xc2\x99\x00\x00\x00\x00IEND\xaeB`\x82'  
 118     return wx
.BitmapFromImage(getImage()) 
 121     stream 
= cStringIO
.StringIO(getData()) 
 122     return wx
.ImageFromStream(stream
) 
 126 frm 
= wx
.Frame(None, title
="DrawHeaderButton Test", size
=(580,300))