source: molecuilder/src/Menu/DisplayMenuItem.cpp@ 795b4d

Last change on this file since 795b4d was aa117c, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added possibility to add default Items to textMenus

  • 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
15DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
16MenuItem('\0',"",_menu),
17view(_view),
18title("")
19{
20}
21
22DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view, string _title, char _spacer, int _length ):
23MenuItem('\0',"",_menu),
24view(_view),
25title(_title),
26spacer(_spacer),
27length(_length)
28{
29}
30
31DisplayMenuItem::~DisplayMenuItem()
32{
33 // TODO Auto-generated destructor stub
34}
35
36
37void DisplayMenuItem::doTrigger(){}
38bool DisplayMenuItem::checkTrigger(char c){
39 return false;
40}
41
42const string DisplayMenuItem::formatEntry(){
43 stringstream s;
44 if(title.length()>0) {
45 int pre = floor((length-title.length())/2.0);
46 int post = ceil((length-title.length())/2.0);
47 for(int i=0;i<pre;i++)
48 s << spacer;
49 s << title;
50 for(int i=0;i<post;i++)
51 s << spacer;
52 s << "\n";
53 }
54 s << view->toString();
55 return s.str();
56}
57
58
59const string DisplayMenuItem::getDescription(){
60 return string("");
61}
Note: See TracBrowser for help on using the repository browser.