test/data/vclamp_jpk/README: Document sample versions
[hooke.git] / hooke / ui / gui / navbar.py
1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
2 #
3 # This file is part of Hooke.
4 #
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
8 # later version.
9 #
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
17
18 """Navigation bar for Hooke.
19 """
20
21 import wx
22 #import wx.aui as aui         # C++ implementation
23 import wx.lib.agw.aui as aui  # Python implementation
24
25 from ...util.callback import callback, in_callback
26
27
28 class NavBar (aui.AuiToolBar):
29     def __init__(self, callbacks, *args, **kwargs):
30         super(NavBar, self).__init__(*args, **kwargs)
31         bitmap_size = wx.Size(16,16)
32         self.SetToolBitmapSize(bitmap_size)
33         self._c = {
34             'previous': self.AddTool(
35                 tool_id=wx.ID_PREVIEW_PREVIOUS,
36                 label='Previous',
37                 bitmap=wx.ArtProvider_GetBitmap(
38                     wx.ART_GO_BACK, wx.ART_OTHER, bitmap_size),
39                 disabled_bitmap=wx.NullBitmap,
40                 kind=wx.ITEM_NORMAL,
41                 short_help_string='Previous curve',
42                 long_help_string='',
43                 client_data=None),
44             'next': self.AddTool(
45                 tool_id=wx.ID_PREVIEW_NEXT,
46                 label='Next',
47                 bitmap=wx.ArtProvider_GetBitmap(
48                     wx.ART_GO_FORWARD, wx.ART_OTHER, bitmap_size),
49                 disabled_bitmap=wx.NullBitmap,
50                 kind=wx.ITEM_NORMAL,
51                 short_help_string='Next curve',
52                 long_help_string='',
53                 client_data=None),
54             'delete': self.AddTool(
55                 tool_id=wx.ID_DELETE,
56                 label='Delete',
57                 bitmap=wx.ArtProvider_GetBitmap(
58                     wx.ART_DELETE, wx.ART_OTHER, bitmap_size),
59                 disabled_bitmap=wx.NullBitmap,
60                 kind=wx.ITEM_NORMAL,
61                 short_help_string='Remove curve from playlist',
62                 long_help_string='',
63                 client_data=None),
64             }
65         self.Realize()
66         self._callbacks = callbacks
67         self.Bind(wx.EVT_TOOL, self._on_next, self._c['next'])
68         self.Bind(wx.EVT_TOOL, self._on_previous, self._c['previous'])
69         self.Bind(wx.EVT_TOOL, self._on_delete, self._c['delete'])
70
71     def _on_next(self, event):
72         self.next()
73
74     def _on_previous(self, event):
75         self.previous()
76
77     def _on_delete(self, event):
78         self.delete()
79
80     @callback
81     def next(self):
82         pass
83
84     @callback
85     def previous(self):
86         pass
87
88     @callback
89     def delete(self):
90         pass