1 | /*********************************************************************** |
---|
2 | filename: required.cpp |
---|
3 | created: 16/3/2005 |
---|
4 | author: Tomas Lindquist Olsen |
---|
5 | |
---|
6 | purpose: Implementation of helper functions |
---|
7 | *************************************************************************/ |
---|
8 | /*************************************************************************** |
---|
9 | * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team |
---|
10 | * |
---|
11 | * Permission is hereby granted, free of charge, to any person obtaining |
---|
12 | * a copy of this software and associated documentation files (the |
---|
13 | * "Software"), to deal in the Software without restriction, including |
---|
14 | * without limitation the rights to use, copy, modify, merge, publish, |
---|
15 | * distribute, sublicense, and/or sell copies of the Software, and to |
---|
16 | * permit persons to whom the Software is furnished to do so, subject to |
---|
17 | * the following conditions: |
---|
18 | * |
---|
19 | * The above copyright notice and this permission notice shall be |
---|
20 | * included in all copies or substantial portions of the Software. |
---|
21 | * |
---|
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
---|
23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
---|
25 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
---|
26 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
---|
27 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
---|
28 | * OTHER DEALINGS IN THE SOFTWARE. |
---|
29 | ***************************************************************************/ |
---|
30 | #include "CEGUI.h" |
---|
31 | #include "required.h" |
---|
32 | |
---|
33 | // Start of CEGUI namespace section |
---|
34 | namespace CEGUI |
---|
35 | { |
---|
36 | |
---|
37 | /************************************************************************* |
---|
38 | Functions for getting Thumb range pairs as two return values |
---|
39 | *************************************************************************/ |
---|
40 | |
---|
41 | // returns horizontal range as two values for lua |
---|
42 | void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max) |
---|
43 | { |
---|
44 | std::pair<float,float> range_pair = wnd->getHorzRange(); |
---|
45 | *min = range_pair.first; |
---|
46 | *max = range_pair.second; |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | // returns vertical range as two values for lua |
---|
51 | void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max) |
---|
52 | { |
---|
53 | std::pair<float,float> range_pair = wnd->getVertRange(); |
---|
54 | *min = range_pair.first; |
---|
55 | *max = range_pair.second; |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | /************************************************************************* |
---|
60 | Functions for creating list box items |
---|
61 | *************************************************************************/ |
---|
62 | |
---|
63 | // allocates and returns a new ListboxTextItem |
---|
64 | ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete) |
---|
65 | { |
---|
66 | return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | /************************************************************************ |
---|
71 | OutStream |
---|
72 | *************************************************************************/ |
---|
73 | void ceguiLua_FileStream_open(FileStream* os, const char* filename) |
---|
74 | { |
---|
75 | os->open(filename, std::ios::binary); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | /************************************************************************ |
---|
80 | CEGUI::System::getSystemKeys alternative |
---|
81 | *************************************************************************/ |
---|
82 | bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k) |
---|
83 | { |
---|
84 | return (k & sys->getSystemKeys()) != 0; |
---|
85 | } |
---|
86 | |
---|
87 | |
---|
88 | } // namespace CEGUI |
---|