calculator: have a different icon and app name for the scientific variant
[nit.git] / examples / calculator / src / scientific / scientific.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Extends the portable calculator app with scientific operations
16 module scientific is
17 app_name "app.nit Calc Sci"
18 app_namespace "org.nitlanguage.scientific_calculator"
19 app_files
20 end
21
22 import calculator
23
24 redef class CalculatorWindow
25 init
26 do
27 # All the button labels, row by row
28 var rows = [["√", "x²", "xⁿ", "e" ],
29 ["log","ln", "%", "x!" ],
30 ["π", "sin","cos","tan"]]
31
32 for row in rows do
33 var row_layout = new HorizontalLayout(parent=layout)
34
35 for op in row do
36 var but = new Button(parent=row_layout, text=op)
37 buttons[op] = but
38 end
39 end
40
41 super
42 end
43 end