3d18e644bd3012d975b6e682cae66a1d10f3f1f7
[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 #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             }
55         self.Realize()
56         self._callbacks = callbacks
57         self.Bind(wx.EVT_TOOL, self._on_next, self._c['next'])
58         self.Bind(wx.EVT_TOOL, self._on_previous, self._c['previous'])
59
60     def _on_next(self, event):
61         self.next()
62
63     def _on_previous(self, event):
64         self.previous()
65
66     @callback
67     def next(self):
68         pass
69
70     @callback
71     def previous(self):
72         pass
73
74
75