Last change
on this file since 25e17e9 was 98a2987, checked in by Tillmann Crueger <crueger@…>, 16 years ago |
Added -Wall flag and fixed several small hickups
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | * DisplayMenuItem.cpp
|
---|
3 | *
|
---|
4 | * Created on: Dec 14, 2009
|
---|
5 | * Author: crueger
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include <sstream>
|
---|
9 | #include <cmath>
|
---|
10 |
|
---|
11 | #include "Menu/DisplayMenuItem.hpp"
|
---|
12 | #include "Views/StringView.hpp"
|
---|
13 |
|
---|
14 |
|
---|
15 | DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
|
---|
16 | MenuItem('\0',"",_menu),
|
---|
17 | view(_view),
|
---|
18 | title("")
|
---|
19 | {
|
---|
20 | }
|
---|
21 |
|
---|
22 | DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view, string _title, char _spacer, int _length ):
|
---|
23 | MenuItem('\0',"",_menu),
|
---|
24 | view(_view),
|
---|
25 | title(_title),
|
---|
26 | length(_length),
|
---|
27 | spacer(_spacer)
|
---|
28 | {
|
---|
29 | }
|
---|
30 |
|
---|
31 | DisplayMenuItem::~DisplayMenuItem()
|
---|
32 | {}
|
---|
33 |
|
---|
34 |
|
---|
35 | void DisplayMenuItem::doTrigger(){}
|
---|
36 | bool DisplayMenuItem::checkTrigger(char c){
|
---|
37 | return false;
|
---|
38 | }
|
---|
39 |
|
---|
40 | const string DisplayMenuItem::formatEntry(){
|
---|
41 | stringstream s;
|
---|
42 | if(title.length()>0) {
|
---|
43 | int pre = floor((length-title.length())/2.0);
|
---|
44 | int post = ceil((length-title.length())/2.0);
|
---|
45 | for(int i=0;i<pre;i++)
|
---|
46 | s << spacer;
|
---|
47 | s << title;
|
---|
48 | for(int i=0;i<post;i++)
|
---|
49 | s << spacer;
|
---|
50 | s << "\n";
|
---|
51 | }
|
---|
52 | s << view->toString();
|
---|
53 | return s.str();
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | const string DisplayMenuItem::getDescription(){
|
---|
58 | return string("");
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.