94a7d062f533915b1fc9b7631e1119127e15704a
[hooke.git] / hooke / ui / gui / navbar.py
1 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
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
23 from ...util.callback import callback, in_callback
24
25
26 class NavBar (wx.ToolBar):
27     def __init__(self, callbacks, *args, **kwargs):
28         super(NavBar, self).__init__(*args, **kwargs)
29         self.SetToolBitmapSize(wx.Size(16,16))
30         self._c = {
31             'previous': self.AddLabelTool(
32                 id=wx.ID_PREVIEW_PREVIOUS,
33                 label='Previous',
34                 bitmap=wx.ArtProvider_GetBitmap(
35                     wx.ART_GO_BACK, wx.ART_OTHER, wx.Size(16, 16)),
36                 shortHelp='Previous curve'),
37             'next': self.AddLabelTool(
38                 id=wx.ID_PREVIEW_NEXT,
39                 label='Next',
40                 bitmap=wx.ArtProvider_GetBitmap(
41                     wx.ART_GO_FORWARD, wx.ART_OTHER, wx.Size(16, 16)),
42                 shortHelp='Next curve'),
43             }
44         self.Realize()
45         self._callbacks = callbacks
46         self.Bind(wx.EVT_TOOL, self._on_next, self._c['next'])
47         self.Bind(wx.EVT_TOOL, self._on_previous, self._c['previous'])
48
49     def _on_next(self, event):
50         self.next()
51
52     def _on_previous(self, event):
53         self.previous()
54
55     @callback
56     def next(self):
57         pass
58
59     @callback
60     def previous(self):
61         pass
62
63
64