| 1 | |
| 2 | import wx |
| 3 | |
| 4 | #---------------------------------------------------------------------- |
| 5 | |
| 6 | |
| 7 | stockIDs = [ |
| 8 | wx.ID_ADD, |
| 9 | wx.ID_APPLY, |
| 10 | wx.ID_BOLD, |
| 11 | wx.ID_CANCEL, |
| 12 | wx.ID_CLEAR, |
| 13 | wx.ID_CLOSE, |
| 14 | wx.ID_COPY, |
| 15 | wx.ID_CUT, |
| 16 | wx.ID_DELETE, |
| 17 | wx.ID_FIND, |
| 18 | wx.ID_REPLACE, |
| 19 | wx.ID_BACKWARD, |
| 20 | wx.ID_DOWN, |
| 21 | wx.ID_FORWARD, |
| 22 | wx.ID_UP, |
| 23 | wx.ID_HELP, |
| 24 | wx.ID_HOME, |
| 25 | wx.ID_INDENT, |
| 26 | wx.ID_INDEX, |
| 27 | wx.ID_ITALIC, |
| 28 | wx.ID_JUSTIFY_CENTER, |
| 29 | wx.ID_JUSTIFY_FILL, |
| 30 | wx.ID_JUSTIFY_LEFT, |
| 31 | wx.ID_JUSTIFY_RIGHT, |
| 32 | wx.ID_NEW, |
| 33 | wx.ID_NO, |
| 34 | wx.ID_OK, |
| 35 | wx.ID_OPEN, |
| 36 | wx.ID_PASTE, |
| 37 | wx.ID_PREFERENCES, |
| 38 | wx.ID_PRINT, |
| 39 | wx.ID_PREVIEW, |
| 40 | wx.ID_PROPERTIES, |
| 41 | wx.ID_EXIT, |
| 42 | wx.ID_REDO, |
| 43 | wx.ID_REFRESH, |
| 44 | wx.ID_REMOVE, |
| 45 | wx.ID_REVERT_TO_SAVED, |
| 46 | wx.ID_SAVE, |
| 47 | wx.ID_SAVEAS, |
| 48 | wx.ID_STOP, |
| 49 | wx.ID_UNDELETE, |
| 50 | wx.ID_UNDERLINE, |
| 51 | wx.ID_UNDO, |
| 52 | wx.ID_UNINDENT, |
| 53 | wx.ID_YES, |
| 54 | wx.ID_ZOOM_100, |
| 55 | wx.ID_ZOOM_FIT, |
| 56 | wx.ID_ZOOM_IN, |
| 57 | wx.ID_ZOOM_OUT, |
| 58 | |
| 59 | ] |
| 60 | |
| 61 | class TestPanel(wx.Panel): |
| 62 | def __init__(self, parent, log): |
| 63 | self.log = log |
| 64 | wx.Panel.__init__(self, parent, -1) |
| 65 | |
| 66 | sizer = wx.FlexGridSizer(cols=5, hgap=4, vgap=4) |
| 67 | for ID in stockIDs: |
| 68 | b = wx.Button(self, ID) |
| 69 | sizer.Add(b) |
| 70 | |
| 71 | self.SetSizer(sizer) |
| 72 | |
| 73 | |
| 74 | #---------------------------------------------------------------------- |
| 75 | |
| 76 | def runTest(frame, nb, log): |
| 77 | win = TestPanel(nb, log) |
| 78 | return win |
| 79 | |
| 80 | #---------------------------------------------------------------------- |
| 81 | |
| 82 | |
| 83 | |
| 84 | overview = """<html><body> |
| 85 | <h2><center>Stock Buttons</center></h2> |
| 86 | |
| 87 | It is now possible to create \"stock\" buttons. Basically this means |
| 88 | that you only have to provide one of the stock IDs (and an empty |
| 89 | label) when creating the button and wxWidgets will choose the stock |
| 90 | label to go with it automatically. Additionally on the platforms that |
| 91 | have a native concept of a stock button (currently only GTK2) then the |
| 92 | native stock button will be used. |
| 93 | |
| 94 | <p>This sample shows buttons for all of the currenlty available stock |
| 95 | IDs. Notice that when the button is created that no label is given, |
| 96 | and compare that with the button that is created. |
| 97 | |
| 98 | |
| 99 | </body></html> |
| 100 | """ |
| 101 | |
| 102 | |
| 103 | |
| 104 | if __name__ == '__main__': |
| 105 | import sys,os |
| 106 | import run |
| 107 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |
| 108 | |