|
Last change
on this file since 6d21bd was 6d21bd, checked in by Tillmann Crueger <crueger@…>, 16 years ago |
|
Added Basis for creating globally accessible and compatible UIElements
- Added Factories for UIElements that can be chosen at programm startup
- Added Dialogs that can be used to query values
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * Dialog.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 5, 2010
|
|---|
| 5 | * Author: crueger
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include <cassert>
|
|---|
| 9 |
|
|---|
| 10 | #include "UIElements/Dialog.hpp"
|
|---|
| 11 |
|
|---|
| 12 | using namespace std;
|
|---|
| 13 |
|
|---|
| 14 | Dialog::Dialog()
|
|---|
| 15 | {
|
|---|
| 16 | // TODO Auto-generated constructor stub
|
|---|
| 17 |
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | Dialog::~Dialog()
|
|---|
| 21 | {
|
|---|
| 22 | // TODO Auto-generated destructor stub
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | void Dialog::queryInt(const char *_title, int *_target) {
|
|---|
| 26 | Query q;
|
|---|
| 27 | q.title = _title;
|
|---|
| 28 | q.type = Int;
|
|---|
| 29 | q.target = (void*) _target;
|
|---|
| 30 |
|
|---|
| 31 | queries.push_back(q);
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | void Dialog::queryString(const char *_title, string *_target) {
|
|---|
| 35 | Query q;
|
|---|
| 36 | q.title = _title;
|
|---|
| 37 | q.type = String;
|
|---|
| 38 | q.target = (void*) _target;
|
|---|
| 39 |
|
|---|
| 40 | queries.push_back(q);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | void Dialog::display(){
|
|---|
| 44 | list<Query>::iterator iter;
|
|---|
| 45 | for(iter=queries.begin(); iter!=queries.end(); iter++){
|
|---|
| 46 | switch((*iter).type) {
|
|---|
| 47 | case Int:
|
|---|
| 48 | handleInt((*iter).title,(int*)((*iter).target));
|
|---|
| 49 | break;
|
|---|
| 50 | case String:
|
|---|
| 51 | handleString((*iter).title,(string*)((*iter).target));
|
|---|
| 52 | break;
|
|---|
| 53 | default:
|
|---|
| 54 | assert(0 && "This type of query does not seem to exist... Something is seriously wrong");
|
|---|
| 55 | break;
|
|---|
| 56 | }
|
|---|
| 57 | }
|
|---|
| 58 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.