535f0f6ea857f45258b719b61b41d2b961a323d7
[hooke.git] / hooke / ui / gui / navbar.py
1 # Copyright
2
3 """Navigation bar for Hooke.
4 """
5
6 import wx
7
8 from ...util.callback import callback, in_callback
9
10
11 class NavBar (wx.ToolBar):
12     def __init__(self, callbacks, *args, **kwargs):
13         super(NavBar, self).__init__(*args, **kwargs)
14         self.SetToolBitmapSize(wx.Size(16,16))
15         self._c = {
16             'previous': self.AddLabelTool(
17                 id=wx.ID_PREVIEW_PREVIOUS,
18                 label='Previous',
19                 bitmap=wx.ArtProvider_GetBitmap(
20                     wx.ART_GO_BACK, wx.ART_OTHER, wx.Size(16, 16)),
21                 shortHelp='Previous curve'),
22             'next': self.AddLabelTool(
23                 id=wx.ID_PREVIEW_NEXT,
24                 label='Next',
25                 bitmap=wx.ArtProvider_GetBitmap(
26                     wx.ART_GO_FORWARD, wx.ART_OTHER, wx.Size(16, 16)),
27                 shortHelp='Next curve'),
28             }
29         self.Realize()
30         self._callbacks = callbacks
31         self.Bind(wx.EVT_TOOL, self._on_next, self._c['next'])
32         self.Bind(wx.EVT_TOOL, self._on_previous, self._c['previous'])
33
34     def _on_next(self, event):
35         self.next()
36
37     def _on_previous(self, event):
38         self.previous()
39
40     @callback
41     def next(self):
42         pass
43
44     @callback
45     def previous(self):
46         pass
47
48
49