Commit 1f1006a1 authored by bitplane's avatar bitplane

Added CuteAlien's IGUISpinBox.

Added setDrawBorder to IGUIEditBox and IGUIStaticText. 
Added setTextAlignment to GUIEditBox and IGUIStaticText, for text justification and vertical alignment.
IGUIEditbox now supports multiple lines using setWordWrap and setMultiLine.
IGUIElement now calls getter and setter functions when serializing, in case of getter/setter overrides.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@745 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6ae1881a
Changes in version 1.4 (... 2007)
- IGUIElement now calls getter and setter functions when serializing,
in case people override them.
- Added setDrawBorder and setTextAlignment to IGUIEditBox and IGUIStaticText.
- IGUIEditBox now supports multiple lines, use setWordWrap and/or setMultiLine.
When MultiLine is true, the edit box inserts a newline instead of sending
EGET_EDITBOX_ENTER events.
- Added IGUISpinBox, by Michael Zeilfelder (CuteAlien).
- Changed irrArray::linear_search to use the == operator rather than <
This may be slower in some cases, but it no longer returns false positives
when searching arrays of classes that override the < operator but
......
......@@ -74,6 +74,9 @@ enum EGUI_ELEMENT_TYPE
//! A window
EGUIET_WINDOW,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! Not an element, amount of elements in there
EGUIET_COUNT,
......@@ -109,6 +112,7 @@ const c8* const GUIElementTypeNames[] =
"tabControl",
"toolBar",
"window",
"spinBox",
0
};
......
......@@ -126,7 +126,10 @@ namespace irr
EGET_MENU_ITEM_SELECTED,
//! The selection in a combo box has been changed
EGET_COMBO_BOX_CHANGED
EGET_COMBO_BOX_CHANGED,
//! The value of a spin box has changed
EGET_SPINBOX_CHANGED
};
} // end namespace gui
......
......@@ -47,6 +47,35 @@ namespace gui
EGDC_BUTTON_TEXT color of the skin. */
virtual void enableOverrideColor(bool enable) = 0;
//! Turns the border on or off
/** \param border: true if you want the border to be drawn, false if not */
virtual void setDrawBorder(bool border) = 0;
//! Sets text justification mode
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
//! Enables or disables word wrap.
/** \param enable: If set to true, words going over one line are
broken to the next line. */
virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled() = 0;
//! Enables or disables newlines.
/** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
instead a newline character will be inserted. */
virtual void setMultiLine(bool enable) = 0;
//! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise
virtual bool isMultiLineEnabled() = 0;
//! Sets the maximum amount of characters which may be entered in the box.
/** \param max: Maximum amount of characters. If 0, the character amount is
infinity. */
......
......@@ -599,7 +599,7 @@ public:
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
out->addInt("Id", ID );
out->addString("Caption", Text.c_str());
out->addString("Caption", getText());
out->addRect("Rect", DesiredRect);
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
......@@ -617,20 +617,22 @@ public:
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
//! relative rect of element
ID = in->getAttributeAsInt("Id");
Text = in->getAttributeAsStringW("Caption").c_str();
IsVisible = in->getAttributeAsBool("Visible");
IsEnabled = in->getAttributeAsBool("Enabled");
setID(in->getAttributeAsInt("Id"));
setText(in->getAttributeAsStringW("Caption").c_str());
setVisible(in->getAttributeAsBool("Visible"));
setEnabled(in->getAttributeAsBool("Enabled"));
core::position2di p = in->getAttributeAsPosition2d("MaxSize");
MaxSize = core::dimension2di(p.X,p.Y);
setMaxSize(core::dimension2di(p.X,p.Y));
p = in->getAttributeAsPosition2d("MinSize");
MinSize = core::dimension2di(p.X,p.Y);
NoClip = in->getAttributeAsBool("NoClip");
AlignLeft = (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames);
AlignRight = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames);
AlignTop = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames);
AlignBottom = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames);
setMinSize(core::dimension2di(p.X,p.Y));
setNotClipped(in->getAttributeAsBool("NoClip"));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames));
setRelativePosition(in->getAttributeAsRect("Rect"));
}
......
......@@ -44,6 +44,7 @@ class IGUIColorSelectDialog;
class IGUIInOutFader;
class IGUIStaticText;
class IGUIEditBox;
class IGUISpinBox;
class IGUITabControl;
class IGUITab;
class IGUIContextMenu;
......@@ -275,17 +276,29 @@ public:
scrolling, copying and pasting (exchanging data with the clipboard directly), maximum
character amount, marking and all shortcuts like ctrl+X, ctrl+V, ctrg+C,
shift+Left, shift+Right, Home, End, and so on.
\param text is the text to be displayed. Can be altered after creation with SetText().
\param text is the text to be displayed. Can be altered after creation with setText().
\param rectangle is the position of the edit box.
\param border has to be set to true if the edit box should have a 3d border.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the edit box directly in the environment.
\param id is a s32 to identify the edit box.
\return
Returns a pointer to the created static text. Returns 0 if an error occured.
Returns a pointer to the created edit box. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a spin box.
/** An edit box with up and down buttons
\param text is the text to be displayed. Can be altered after creation with setText().
\param rectangle is the position of the spin box.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the spin box directly in the environment.
\param id is a s32 to identify the spin box.
\return
Returns a pointer to the created spin box. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an element for fading in or out.
/* \param rectangle: Pointer to rectangle specifing the borders of the element.
If the pointer is NULL, the whole screen is used.
......
// Copyright (C) 2006 Michael Zeilfelder
// This file uses the licence of the Irrlicht Engine.
#ifndef __I_GUI_SPIN_BOX_H_INCLUDED__
#define __I_GUI_SPIN_BOX_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
class IGUIEditBox;
//! Single line edit box + spin buttons
class IGUISpinBox : public IGUIElement
{
public:
//! constructor
IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUISpinBox() {};
//! Access the edit box used in the spin control
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual IGUIEditBox* getEditBox() = 0;
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val) = 0;
//! Get the current value of the spinbox
virtual f32 getValue() = 0;
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
\param max: maximum value */
virtual void setRange(f32 min, f32 max) = 0;
//! get the minimum value which can be used in the spinbox
virtual f32 getMin() = 0;
//! get the maximum value which can be used in the spinbox
virtual f32 getMax() = 0;
//! Step size by which values are changed when pressing the spinbuttons
/** The step size also determines the number of decimal places to display
\param step: stepsize used for value changes when pressing spinbuttons */
virtual void setStepSize(f32 step=1.f) = 0;
//! Sets the number of decimal places to display.
/** \param places: The number of decimal places to display, use -1 to reset */
virtual void setDecimalPlaces(s32 places) = 0;
//! get the current step size
virtual f32 getStepSize() = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPIN_BOX_H_INCLUDED__
......@@ -65,9 +65,19 @@ namespace gui
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw) = 0;
//! Sets whether to draw the border
virtual void setDrawBorder(bool draw) = 0;
//! Sets text justification mode
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
//! Enables or disables word wrap for using the static text as multiline text control.
/** \param enable: If set to true, words going over one line are
breaked to the next line. */
broken on to the next line. */
virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled
......
......@@ -77,6 +77,7 @@
#include "IGUITabControl.h"
#include "IGUIWindow.h"
#include "IGUIToolbar.h"
#include "IGUISpinBox.h"
#include "IImage.h"
#include "ILightSceneNode.h"
#include "ILogger.h"
......
......@@ -9,6 +9,7 @@
#include "IGUIComboBox.h"
#include "IGUIContextMenu.h"
#include "IGUIEditBox.h"
#include "IGUISpinBox.h"
#include "IGUIFileOpenDialog.h"
#include "IGUIColorSelectDialog.h"
#include "IGUIInOutFader.h"
......@@ -86,7 +87,8 @@ IGUIElement* CDefaultGUIElementFactory::addGUIElement(EGUI_ELEMENT_TYPE type, IG
return Environment->addToolBar(parent);
case EGUIET_WINDOW:
return Environment->addWindow(core::rect<s32>(0,0,100,100),false,0,parent);
case EGUIET_SPIN_BOX:
return Environment->addSpinBox(L"0.0", core::rect<s32>(0,0,100,100), parent);
}
return 0;
......
......@@ -11,6 +11,15 @@
#include "os.h"
#include "Keycodes.h"
/*
todo:
optional scrollbars
ctrl+left/right to select word
double click/ctrl click: word select + drag to select whole words
optional dragging selected text
optional triple click to select line
*/
namespace irr
{
namespace gui
......@@ -23,7 +32,10 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi
: IGUIEditBox(environment, parent, id, rectangle), MouseMarking(false),
Border(border), OverrideColorEnabled(false), MarkBegin(0), MarkEnd(0),
OverrideColor(video::SColor(101,255,255,255)),
OverrideFont(0), CursorPos(0), ScrollPos(0), Max(0)
OverrideFont(0), LastBreakFont(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0),
WordWrap(false), MultiLine(false), AutoScroll(true),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER)
{
#ifdef _DEBUG
setDebugName("CGUIEditBox");
......@@ -35,6 +47,8 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi
if (Operator)
Operator->grab();
breakText();
}
......@@ -59,6 +73,8 @@ void CGUIEditBox::setOverrideFont(IGUIFont* font)
if (OverrideFont)
OverrideFont->grab();
breakText();
}
......@@ -69,14 +85,56 @@ void CGUIEditBox::setOverrideColor(video::SColor color)
OverrideColorEnabled = true;
}
//! Turns the border on or off
void CGUIEditBox::setDrawBorder(bool border)
{
Border = border;
}
//! Sets if the text should use the overide color or the
//! color in the gui skin.
//! Sets if the text should use the overide color or the color in the gui skin.
void CGUIEditBox::enableOverrideColor(bool enable)
{
OverrideColorEnabled = enable;
}
//! Enables or disables word wrap
void CGUIEditBox::setWordWrap(bool enable)
{
WordWrap = enable;
breakText();
}
void CGUIEditBox::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
breakText();
}
//! Checks if word wrap is enabled
bool CGUIEditBox::isWordWrapEnabled()
{
return WordWrap;
}
//! Enables or disables newlines.
void CGUIEditBox::setMultiLine(bool enable)
{
MultiLine = enable;
}
//! Checks if multi line editing is enabled
bool CGUIEditBox::isMultiLineEnabled()
{
return MultiLine;
}
//! Sets text justification
void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
HAlign = horizontal;
VAlign = vertical;
}
//! called if an event happened.
bool CGUIEditBox::OnEvent(SEvent event)
......@@ -113,12 +171,19 @@ bool CGUIEditBox::processKey(const SEvent& event)
if (!event.KeyInput.PressedDown)
return false;
bool textChanged = false;
// control shortcut handling
if (event.KeyInput.Control)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_A:
// select all
MarkBegin = 0;
MarkEnd = Text.size();
break;
case KEY_KEY_C:
// copy to clipboard
if (Operator && MarkBegin != MarkEnd)
......@@ -132,9 +197,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
}
break;
case KEY_KEY_X:
if ( !this->IsEnabled )
break;
// cut to the clipboard
if (Operator && MarkBegin != MarkEnd)
{
......@@ -146,19 +208,23 @@ bool CGUIEditBox::processKey(const SEvent& event)
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
// delete
core::stringw s;
s = Text.subString(0, realmbgn);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
if (IsEnabled)
{
// delete
core::stringw s;
s = Text.subString(0, realmbgn);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn;
MarkBegin = 0;
MarkEnd = 0;
CursorPos = realmbgn;
MarkBegin = 0;
MarkEnd = 0;
textChanged = true;
}
}
break;
case KEY_KEY_V:
if ( !this->IsEnabled )
if ( !IsEnabled )
break;
// paste from the clipboard
......@@ -204,6 +270,37 @@ bool CGUIEditBox::processKey(const SEvent& event)
MarkBegin = 0;
MarkEnd = 0;
textChanged = true;
}
break;
case KEY_HOME:
// move/highlight to start of text
if (event.KeyInput.Shift)
{
MarkEnd = CursorPos;
MarkBegin = 0;
CursorPos = 0;
}
else
{
CursorPos = 0;
MarkBegin = 0;
MarkEnd = 0;
}
break;
case KEY_END:
// move/highlight to end of text
if (event.KeyInput.Shift)
{
MarkBegin = CursorPos;
MarkEnd = Text.size();
CursorPos = 0;
}
else
{
CursorPos = Text.size();
MarkBegin = 0;
MarkEnd = 0;
}
break;
default:
......@@ -217,36 +314,63 @@ bool CGUIEditBox::processKey(const SEvent& event)
switch(event.KeyInput.Key)
{
case KEY_END:
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
MarkBegin = CursorPos;
MarkEnd = Text.size();
}
else
{
MarkBegin = 0;
MarkEnd = 0;
s32 p = Text.size();
if (WordWrap || MultiLine)
{
p = getLineFromPos(CursorPos);
p = BrokenTextPositions[p] + (s32)BrokenText[p].size();
if (p > 0 && (Text[p-1] == L'\r' || Text[p-1] == L'\n' ))
p-=1;
}
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
MarkBegin = CursorPos;
MarkEnd = p;
}
else
{
MarkBegin = 0;
MarkEnd = 0;
}
CursorPos = p;
BlinkStartTime = os::Timer::getTime();
}
CursorPos = Text.size();
BlinkStartTime = os::Timer::getTime();
break;
case KEY_HOME:
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
MarkBegin = CursorPos;
MarkEnd = 0;
}
else
{
MarkBegin = 0;
MarkEnd = 0;
s32 p = 0;
if (WordWrap || MultiLine)
{
p = getLineFromPos(CursorPos);
p = BrokenTextPositions[p];
}
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
MarkBegin = CursorPos;
MarkEnd = p;
}
else
{
MarkBegin = 0;
MarkEnd = 0;
}
CursorPos = p;
BlinkStartTime = os::Timer::getTime();
}
CursorPos = 0;
BlinkStartTime = os::Timer::getTime();
break;
case KEY_RETURN:
if (MultiLine)
{
inputChar(L'\n');
}
else
{
SEvent e;
e.EventType = EET_GUI_EVENT;
......@@ -278,7 +402,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
break;
case KEY_RIGHT:
if (event.KeyInput.Shift)
{
if (Text.size() > (u32)CursorPos)
......@@ -298,6 +421,58 @@ bool CGUIEditBox::processKey(const SEvent& event)
if (Text.size() > (u32)CursorPos) CursorPos++;
BlinkStartTime = os::Timer::getTime();
break;
case KEY_UP:
{
s32 lineNo = getLineFromPos(CursorPos);
s32 mb = (MarkBegin == MarkEnd) ? CursorPos : (MarkBegin > MarkEnd ? MarkBegin : MarkEnd);
if (lineNo > 0)
{
s32 cp = CursorPos - BrokenTextPositions[lineNo];
if ((s32)BrokenText[lineNo-1].size() < cp)
CursorPos = BrokenTextPositions[lineNo-1] + (s32)BrokenText[lineNo-1].size()-1;
else
CursorPos = BrokenTextPositions[lineNo-1] + cp;
}
if (event.KeyInput.Shift)
{
MarkBegin = mb;
MarkEnd = CursorPos;
}
else
{
MarkBegin = 0;
MarkEnd = 0;
}
}
break;
case KEY_DOWN:
{
s32 lineNo = getLineFromPos(CursorPos);
s32 mb = (MarkBegin == MarkEnd) ? CursorPos : (MarkBegin < MarkEnd ? MarkBegin : MarkEnd);
if (lineNo < (s32)BrokenText.size()-1)
{
s32 cp = CursorPos - BrokenTextPositions[lineNo];
if ((s32)BrokenText[lineNo+1].size() < cp)
CursorPos = BrokenTextPositions[lineNo+1] + BrokenText[lineNo+1].size()-1;
else
CursorPos = BrokenTextPositions[lineNo+1] + cp;
}
if (event.KeyInput.Shift)
{
MarkBegin = mb;
MarkEnd = CursorPos;
}
else
{
MarkBegin = 0;
MarkEnd = 0;
}
}
break;
case KEY_BACK:
if ( !this->IsEnabled )
......@@ -336,6 +511,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
BlinkStartTime = os::Timer::getTime();
MarkBegin = 0;
MarkEnd = 0;
textChanged = true;
}
break;
case KEY_DELETE:
......@@ -372,86 +548,50 @@ bool CGUIEditBox::processKey(const SEvent& event)
BlinkStartTime = os::Timer::getTime();
MarkBegin = 0;
MarkEnd = 0;
textChanged = true;
}
break;
default:
if ( !this->IsEnabled )
break;
if (event.KeyInput.Char != 0)
{
if (Text.size() < (u32)Max || Max == 0)
{
core::stringw s;
if (MarkBegin != MarkEnd)
{
// replace marked text
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
case KEY_ESCAPE:
case KEY_TAB:
case KEY_SHIFT:
case KEY_F1:
case KEY_F2:
case KEY_F3:
case KEY_F4:
case KEY_F5:
case KEY_F6:
case KEY_F7:
case KEY_F8:
case KEY_F9:
case KEY_F10:
case KEY_F11:
case KEY_F12:
case KEY_F13:
case KEY_F14:
case KEY_F15:
case KEY_F16:
case KEY_F17:
case KEY_F18:
case KEY_F19:
case KEY_F20:
case KEY_F21:
case KEY_F22:
case KEY_F23:
case KEY_F24:
// ignore these keys
return false;
s = Text.subString(0, realmbgn);
s.append(event.KeyInput.Char);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn+1;
}
else
{
// add new character
s = Text.subString(0, CursorPos);
s.append(event.KeyInput.Char);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
Text = s;
++CursorPos;
}
BlinkStartTime = os::Timer::getTime();
MarkBegin = 0;
MarkEnd = 0;
}
}
default:
inputChar(event.KeyInput.Char);
break;
}
// calculate scrollpos
IGUIFont* font = OverrideFont;
IGUISkin* skin = Environment->getSkin();
if (!OverrideFont)
font = skin->getFont();
// break the text if it has changed
if (textChanged)
breakText();
s32 cursorwidth = font->getDimension(L"_ ").Width;
s32 minwidht = cursorwidth*2;
if (minwidht >= AbsoluteRect.getWidth())
minwidht = AbsoluteRect.getWidth() / 2;
s32 tries = Text.size()*2;
if (tries < 100)
tries = 100;
for (s32 t=0; t<tries; ++t)
{
core::stringw s = Text.subString(0,CursorPos);
s32 charcursorpos = font->getDimension(s.c_str()).Width;
s = Text.subString(0, ScrollPos);
s32 charscrollpos = font->getDimension(s.c_str()).Width;
if ((charcursorpos + cursorwidth - charscrollpos) > AbsoluteRect.getWidth())
ScrollPos++;
else
if ((charcursorpos + cursorwidth - charscrollpos) < minwidht)
{
if (ScrollPos > 0)
ScrollPos--;
else
break;
}
else
break;
}
calculateScrollPos();
return true;
}
......@@ -470,7 +610,7 @@ void CGUIEditBox::draw()
irr::video::IVideoDriver* driver = Environment->getVideoDriver();
core::rect<s32> frameRect(AbsoluteRect);
frameRect = AbsoluteRect;
// draw the border
......@@ -479,8 +619,13 @@ void CGUIEditBox::draw()
skin->draw3DSunkenPane(this, skin->getColor(EGDC_WINDOW),
false, true, frameRect, &AbsoluteClippingRect);
frameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X);
frameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
frameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
frameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
frameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
}
core::rect<s32> localClipRect = frameRect;
localClipRect.clipAgainst(AbsoluteClippingRect);
// draw the text
......@@ -488,106 +633,127 @@ void CGUIEditBox::draw()
if (!OverrideFont)
font = skin->getFont();
s32 cursorLine = 0;
s32 charcursorpos = 0;
if (font)
{
// calculate cursor pos
core::stringw s = Text.subString(0,CursorPos);
s32 charcursorpos = font->getDimension(s.c_str()).Width;
s = Text.subString(0, ScrollPos);
s32 charscrollpos = font->getDimension(s.c_str()).Width;
core::rect<s32> rct;
// draw mark
if (focus && MarkBegin != MarkEnd)
{
rct = frameRect;
rct.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y);
rct.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y);
if (LastBreakFont != font)
breakText();
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s = Text.subString(0, realmbgn);
s32 mbegin = font->getDimension(s.c_str()).Width;
s = Text.subString(realmbgn, realmend - realmbgn);
s32 mend = font->getDimension(s.c_str()).Width;
rct.UpperLeftCorner.X += mbegin - charscrollpos;
rct.LowerRightCorner.X = rct.UpperLeftCorner.X + mend;
driver->draw2DRectangle(skin->getColor(EGDC_HIGH_LIGHT), rct, &AbsoluteClippingRect);
}
// calculate cursor pos
// draw cursor
core::stringw *txtLine = &Text;
s32 startPos = 0;
if (focus && (os::Timer::getTime() - BlinkStartTime) % 700 < 350)
{
rct = frameRect;
rct.UpperLeftCorner.X += charcursorpos;
rct.UpperLeftCorner.X -= charscrollpos;
core::stringw s, s2;
font->draw(L"_", rct,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_BUTTON_TEXT),
false, true, &AbsoluteClippingRect);
}
// get mark position
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s32 hlineStart = (WordWrap || MultiLine) ? getLineFromPos(realmbgn) : 0;
s32 hlineCount = (WordWrap || MultiLine) ? getLineFromPos(realmend) - hlineStart + 1 : 1;
s32 lineCount = (WordWrap || MultiLine) ? BrokenText.size() : 1;
// draw text
// Save the override color information.
// Then, alter it if the edit box is disabled.
bool prevOver = OverrideColorEnabled;
video::SColor prevColor = OverrideColor;
if (Text.size())
{
rct = frameRect;
rct.UpperLeftCorner.X -= charscrollpos;
// Save the override color information.
// Then, alter it if the edit box is disabled.
bool prevOver = OverrideColorEnabled;
video::SColor prevColor = OverrideColor;
if ( !this->IsEnabled && !OverrideColorEnabled )
{
OverrideColorEnabled = true;
OverrideColor = skin->getColor( EGDC_GRAY_TEXT );
}
if (focus && MarkBegin != MarkEnd)
for (s32 i=0; i < lineCount; ++i)
{
// marked text
setTextRect(i);
font->draw(Text.c_str(), rct,
// clipping test - don't draw anything outside the visible area
core::rect<s32> c = localClipRect;
c.clipAgainst(CurrentTextRect);
if (!c.isValid())
continue;
// get current line
txtLine = (WordWrap || MultiLine) ? &BrokenText[i] : &Text;
startPos = (WordWrap || MultiLine) ? BrokenTextPositions[i] : 0;
// draw normal text
font->draw(txtLine->c_str(), CurrentTextRect,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_BUTTON_TEXT),
false, true, &AbsoluteClippingRect);
false, true, &localClipRect);
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// draw mark and marked text
if (focus && MarkBegin != MarkEnd && i >= hlineStart && i < hlineStart + hlineCount)
{
s32 mbegin = 0, mend = 0;
s32 lineStartPos = 0, lineEndPos = txtLine->size();
s = Text.subString(0, realmbgn);
s32 mbegin = font->getDimension(s.c_str()).Width;
if (i == hlineStart)
{
// highlight start is on this line
s = txtLine->subString(0, realmbgn - startPos);
mbegin = font->getDimension(s.c_str()).Width;
lineStartPos = realmbgn - startPos;
}
if (i == hlineStart + hlineCount - 1)
{
// highlight end is on this line
s2 = txtLine->subString(0, realmend - startPos);
mend = font->getDimension(s2.c_str()).Width;
lineEndPos = (s32)s2.size();
}
else
mend = font->getDimension(txtLine->c_str()).Width;
s = Text.subString(realmbgn, realmend - realmbgn);
CurrentTextRect.UpperLeftCorner.X += mbegin;
CurrentTextRect.LowerRightCorner.X = CurrentTextRect.UpperLeftCorner.X + mend - mbegin;
rct.UpperLeftCorner.X += mbegin;
// draw mark
driver->draw2DRectangle(skin->getColor(EGDC_HIGH_LIGHT), CurrentTextRect, &localClipRect);
font->draw(s.c_str(), rct,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_HIGH_LIGHT_TEXT),
false, true, &AbsoluteClippingRect);
}
else
{
// normal text
font->draw(Text.c_str(), rct,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_BUTTON_TEXT),
false, true, &AbsoluteClippingRect);
// draw marked text
s = txtLine->subString(lineStartPos, lineEndPos - lineStartPos);
if (s.size())
font->draw(s.c_str(), CurrentTextRect,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_HIGH_LIGHT_TEXT),
false, true, &localClipRect);
}
}
// Return the override color information to its previous settings.
OverrideColorEnabled = prevOver;
OverrideColor = prevColor;
}
// draw cursor
if (WordWrap || MultiLine)
{
cursorLine = getLineFromPos(CursorPos);
txtLine = &BrokenText[cursorLine];
startPos = BrokenTextPositions[cursorLine];
}
s = txtLine->subString(0,CursorPos-startPos);
charcursorpos = font->getDimension(s.c_str()).Width;
if (focus && (os::Timer::getTime() - BlinkStartTime) % 700 < 350)
{
setTextRect(cursorLine);
CurrentTextRect.UpperLeftCorner.X += charcursorpos;
font->draw(L"_", CurrentTextRect,
OverrideColorEnabled ? OverrideColor : skin->getColor(EGDC_BUTTON_TEXT),
false, true, &localClipRect);
}
}
}
......@@ -596,9 +762,10 @@ void CGUIEditBox::setText(const wchar_t* text)
{
Text = text;
CursorPos = 0;
ScrollPos = 0;
HScrollPos = 0;
MarkBegin = 0;
MarkEnd = 0;
breakText();
}
......@@ -630,7 +797,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
case irr::EMIE_LMOUSE_LEFT_UP:
if (Environment->hasFocus(this))
{
CursorPos = getCursorPos(event.MouseInput.X);
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
if (MouseMarking)
MarkEnd = CursorPos;
MouseMarking = false;
......@@ -641,7 +808,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
{
if (MouseMarking)
{
CursorPos = getCursorPos(event.MouseInput.X);
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
MarkEnd = CursorPos;
return true;
}
......@@ -654,7 +821,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
BlinkStartTime = os::Timer::getTime();
Environment->setFocus(this);
MouseMarking = true;
CursorPos = getCursorPos(event.MouseInput.X);
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
MarkBegin = CursorPos;
MarkEnd = CursorPos;
return true;
......@@ -670,8 +837,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
}
// move cursor
CursorPos = getCursorPos(event.MouseInput.X);
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
if (!MouseMarking)
MarkBegin = CursorPos;
......@@ -686,41 +852,371 @@ bool CGUIEditBox::processMouse(const SEvent& event)
}
s32 CGUIEditBox::getCursorPos(s32 x)
s32 CGUIEditBox::getCursorPos(s32 x, s32 y)
{
IGUIFont* font = OverrideFont;
IGUISkin* skin = Environment->getSkin();
if (!OverrideFont)
font = skin->getFont();
core::stringw s = Text.subString(0, ScrollPos);
s32 charscrollpos = font->getDimension(s.c_str()).Width;
u32 lineCount = 1;
if (WordWrap || MultiLine)
lineCount = BrokenText.size();
core::stringw *txtLine;
s32 startPos=0;
x+=3;
s32 idx = font->getCharacterFromPos(Text.c_str(), x - (AbsoluteRect.UpperLeftCorner.X + 3) + charscrollpos);
for (u32 i=0; i < lineCount; ++i)
{
setTextRect(i);
if (i == 0 && y < CurrentTextRect.UpperLeftCorner.Y)
y = CurrentTextRect.UpperLeftCorner.Y;
if (i == lineCount - 1 && y > CurrentTextRect.LowerRightCorner.Y )
y = CurrentTextRect.LowerRightCorner.Y;
// is it inside this region?
if (y >= CurrentTextRect.UpperLeftCorner.Y && y <= CurrentTextRect.LowerRightCorner.Y)
{
// we've found the clicked line
txtLine = (WordWrap || MultiLine) ? &BrokenText[i] : &Text;
startPos = (WordWrap || MultiLine) ? BrokenTextPositions[i] : 0;
break;
}
}
if (x < CurrentTextRect.UpperLeftCorner.X)
x = CurrentTextRect.UpperLeftCorner.X;
s32 idx = font->getCharacterFromPos(Text.c_str(), x - CurrentTextRect.UpperLeftCorner.X);
// click was on or left of the line
if (idx != -1)
return idx;
return idx + startPos;
// click was off the right edge of the line, go to end.
return txtLine->size() + startPos;
}
//! Breaks the single text line.
void CGUIEditBox::breakText()
{
IGUISkin* skin = Environment->getSkin();
if ((!WordWrap && !MultiLine) || !skin)
return;
BrokenText.clear(); // need to reallocate :/
BrokenTextPositions.set_used(0);
IGUIFont* font = OverrideFont;
if (!OverrideFont)
font = skin->getFont();
if (!font)
return;
LastBreakFont = font;
core::stringw line;
core::stringw word;
core::stringw whitespace;
s32 lastLineStart = 0;
s32 size = Text.size();
s32 length = 0;
s32 elWidth = RelativeRect.getWidth() - 6;
wchar_t c;
for (s32 i=0; i<size; ++i)
{
c = Text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks
{
lineBreak = true;
c = ' ';
if (Text[i+1] == L'\n') // Windows breaks
{
Text.erase(i+1);
--size;
}
}
else if (c == L'\n') // Unix breaks
{
lineBreak = true;
c = ' ';
}
// don't break if we're not a multi-line edit box
if (!MultiLine)
lineBreak = false;
if (c == L' ' || c == 0 || i == (size-1))
{
if (word.size())
{
// here comes the next whitespace, look if
// we can break the last word to the next line.
s32 whitelgth = font->getDimension(whitespace.c_str()).Width;
s32 worldlgth = font->getDimension(word.c_str()).Width;
if (WordWrap && length + worldlgth + whitelgth > elWidth)
{
// break to next line
length = worldlgth;
BrokenText.push_back(line);
BrokenTextPositions.push_back(lastLineStart);
lastLineStart = i - (s32)word.size();
line = word;
}
else
{
// add word to line
line += whitespace;
line += word;
length += whitelgth + worldlgth;
}
word = L"";
whitespace = L"";
}
whitespace += c;
// compute line break
if (lineBreak)
{
line += whitespace;
line += word;
BrokenText.push_back(line);
BrokenTextPositions.push_back(lastLineStart);
lastLineStart = i+1;
line = L"";
word = L"";
whitespace = L"";
length = 0;
}
}
else
{
// yippee this is a word..
word += c;
}
}
line += whitespace;
line += word;
BrokenText.push_back(line);
BrokenTextPositions.push_back(lastLineStart);
}
void CGUIEditBox::setTextRect(s32 line)
{
core::dimension2di d;
s32 lineCount = 1;
IGUIFont* font = OverrideFont;
IGUISkin* skin = Environment->getSkin();
if (!OverrideFont)
font = skin->getFont();
// get text dimension
if (WordWrap || MultiLine)
{
lineCount = BrokenText.size();
d = font->getDimension(BrokenText[line].c_str());
}
else
{
d = font->getDimension(Text.c_str());
d.Height = AbsoluteRect.getHeight();
}
d.Height += font->getKerningHeight();
// justification
switch (HAlign)
{
case EGUIA_CENTER:
// align to h centre
CurrentTextRect.UpperLeftCorner.X = (frameRect.getWidth()/2) - (d.Width/2);
CurrentTextRect.LowerRightCorner.X = (frameRect.getWidth()/2) + (d.Width/2);
break;
case EGUIA_LOWERRIGHT:
// align to right edge
CurrentTextRect.UpperLeftCorner.X = frameRect.getWidth() - d.Width;
CurrentTextRect.LowerRightCorner.X = frameRect.getWidth();
break;
default:
// align to left edge
CurrentTextRect.UpperLeftCorner.X = 0;
CurrentTextRect.LowerRightCorner.X = d.Width;
}
switch (VAlign)
{
case EGUIA_CENTER:
// align to v centre
CurrentTextRect.UpperLeftCorner.Y =
(frameRect.getHeight()/2) - (lineCount*d.Height)/2 + d.Height*line;
break;
case EGUIA_LOWERRIGHT:
// align to bottom edge
CurrentTextRect.UpperLeftCorner.Y =
frameRect.getHeight() - lineCount*d.Height + d.Height*line;
break;
default:
// align to top edge
CurrentTextRect.UpperLeftCorner.Y = d.Height*line;
break;
}
CurrentTextRect.UpperLeftCorner.X -= HScrollPos;
CurrentTextRect.LowerRightCorner.X -= HScrollPos;
CurrentTextRect.UpperLeftCorner.Y -= VScrollPos;
CurrentTextRect.LowerRightCorner.Y = CurrentTextRect.UpperLeftCorner.Y + d.Height;
CurrentTextRect += frameRect.UpperLeftCorner;
}
s32 CGUIEditBox::getLineFromPos(s32 pos)
{
if (!WordWrap && !MultiLine)
return 0;
return Text.size();
s32 i=0;
while (i < (s32)BrokenTextPositions.size())
{
if (BrokenTextPositions[i] > pos)
return i-1;
++i;
}
return (s32)BrokenTextPositions.size() - 1;
}
void CGUIEditBox::inputChar(wchar_t c)
{
if (!IsEnabled)
return;
if (c != 0)
{
if (Text.size() < (u32)Max || Max == 0)
{
core::stringw s;
if (MarkBegin != MarkEnd)
{
// replace marked text
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s = Text.subString(0, realmbgn);
s.append(c);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn+1;
}
else
{
// add new character
s = Text.subString(0, CursorPos);
s.append(c);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
Text = s;
++CursorPos;
}
BlinkStartTime = os::Timer::getTime();
MarkBegin = 0;
MarkEnd = 0;
}
}
breakText();
}
void CGUIEditBox::calculateScrollPos()
{
if (!AutoScroll)
return;
// calculate horizontal scroll position
s32 cursLine = getLineFromPos(CursorPos);
setTextRect(cursLine);
// don't do horizontal scrolling when wordwrap is enabled.
if (!WordWrap)
{
// get cursor position
IGUIFont* font = OverrideFont;
IGUISkin* skin = Environment->getSkin();
if (!OverrideFont)
font = skin->getFont();
core::stringw *txtLine = MultiLine ? &BrokenText[cursLine] : &Text;
s32 cPos = MultiLine ? CursorPos - BrokenTextPositions[cursLine] : CursorPos;
s32 cStart = CurrentTextRect.UpperLeftCorner.X + HScrollPos +
font->getDimension(txtLine->subString(0, cPos).c_str()).Width;
s32 cEnd = cStart + font->getDimension(L"_ ").Width;
if (frameRect.LowerRightCorner.X < cEnd)
HScrollPos = cEnd - frameRect.LowerRightCorner.X;
else if (frameRect.UpperLeftCorner.X > cStart)
HScrollPos = cStart - frameRect.UpperLeftCorner.X;
else
HScrollPos = 0;
// todo: adjust scrollbar
}
// vertical scroll position
if (frameRect.LowerRightCorner.Y < CurrentTextRect.LowerRightCorner.Y + VScrollPos)
VScrollPos = CurrentTextRect.LowerRightCorner.Y - frameRect.LowerRightCorner.Y + VScrollPos;
else if (frameRect.UpperLeftCorner.Y > CurrentTextRect.UpperLeftCorner.Y + VScrollPos)
VScrollPos = CurrentTextRect.UpperLeftCorner.Y - frameRect.UpperLeftCorner.Y + VScrollPos;
else
VScrollPos = 0;
// todo: adjust scrollbar
}
//! Writes attributes of the element.
void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
IGUIEditBox::serializeAttributes(out,options);
out->addBool ("OverrideColorEnabled", OverrideColorEnabled );
out->addColor ("OverrideColor", OverrideColor);
// IGUIEditBox::serializeAttributes(out,options);
out->addBool ("OverrideColorEnabled", OverrideColorEnabled );
out->addColor ("OverrideColor", OverrideColor);
// out->addFont("OverrideFont",OverrideFont);
out->addInt ("MaxChars", Max);
out->addInt ("MaxChars", Max);
out->addBool ("WordWrap", WordWrap);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
IGUIEditBox::serializeAttributes(out,options);
}
//! Reads attributes of the element
void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIEditBox::deserializeAttributes(in,options);
setOverrideColor(in->getAttributeAsColor("OverrideColor"));
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
setMax(in->getAttributeAsInt("MaxChars"));
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
}
......
......@@ -34,6 +34,28 @@ namespace gui
//! color in the gui skin.
virtual void enableOverrideColor(bool enable);
//! Turns the border on or off
virtual void setDrawBorder(bool border);
//! Enables or disables word wrap for using the edit box as multiline text editor.
virtual void setWordWrap(bool enable);
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled();
//! Enables or disables newlines.
/** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
instead a newline character will be inserted. */
virtual void setMultiLine(bool enable);
//! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise
virtual bool isMultiLineEnabled();
//! Sets text justification
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
//! called if an event happened.
virtual bool OnEvent(SEvent event);
......@@ -51,6 +73,9 @@ namespace gui
//! Returns maximum amount of characters, previously set by setMax();
virtual s32 getMax();
//! Updates the absolute position, splits text if required
virtual void updateAbsolutePosition();
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);
......@@ -58,10 +83,20 @@ namespace gui
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
protected:
//! Breaks the single text line.
void breakText();
//! sets the area of the given line
void setTextRect(s32 line);
//! returns the line number that the cursor is on
s32 getLineFromPos(s32 pos);
//! adds a letter to the edit box
void inputChar(wchar_t c);
//! calculates the current scroll position
void calculateScrollPos();
bool processKey(const SEvent& event);
bool processMouse(const SEvent& event);
s32 getCursorPos(s32 x);
s32 getCursorPos(s32 x, s32 y);
bool MouseMarking;
bool Border;
......@@ -70,13 +105,22 @@ namespace gui
s32 MarkEnd;
video::SColor OverrideColor;
gui::IGUIFont* OverrideFont;
gui::IGUIFont *OverrideFont, *LastBreakFont;
IOSOperator* Operator;
u32 BlinkStartTime;
s32 CursorPos;
s32 ScrollPos; // scrollpos in characters
s32 HScrollPos, VScrollPos; // scroll position in characters
s32 Max;
bool WordWrap, MultiLine, AutoScroll;
EGUI_ALIGNMENT HAlign, VAlign;
core::array< core::stringw > BrokenText;
core::array< s32 > BrokenTextPositions;
core::rect<s32> CurrentTextRect, frameRect; // temporary values
};
} // end namespace gui
......
......@@ -20,6 +20,7 @@
#include "CGUIColorSelectDialog.h"
#include "CGUIStaticText.h"
#include "CGUIEditBox.h"
#include "CGUISpinBox.h"
#include "CGUIInOutFader.h"
#include "CGUIMessageBox.h"
#include "CGUIModalScreen.h"
......@@ -236,7 +237,8 @@ void CGUIEnvironment::removeFocus(IGUIElement* element)
e.GUIEvent.Caller = Focus;
e.GUIEvent.EventType = EGET_ELEMENT_FOCUS_LOST;
Focus->OnEvent(e);
Focus->drop();
if (Focus)
Focus->drop();
Focus = 0;
}
}
......@@ -1058,6 +1060,18 @@ IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
return d;
}
//! Adds a spin box to the environment
IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text,
const core::rect<s32> &rectangle,
IGUIElement* parent, s32 id)
{
IGUISpinBox* d = new CGUISpinBox(text, this, parent ? parent : this, id, rectangle);
d->drop();
return d;
}
//! Adds a tab control to the environment.
IGUITabControl* CGUIEnvironment::addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent, bool fillbackground, bool border, s32 id)
......
......@@ -123,6 +123,10 @@ public:
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=false, IGUIElement* parent=0, s32 id=-1);
//! Adds a spin box to the environment
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1);
//! Adds a tab control to the environment.
virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent=0, bool fillbackground=false, bool border=true, s32 id=-1);
......
// Copyright (C) 2006 Michael Zeilfelder
// This file uses the licence of the Irrlicht Engine.
#include "IrrCompileConfig.h"
#include "CGUISpinBox.h"
#include "CGUIEditBox.h"
#include "CGUIButton.h"
#include "IGUIEnvironment.h"
#include "IEventReceiver.h"
#include "fast_atof.h"
#include <float.h>
#include <wchar.h>
namespace irr
{
namespace gui
{
//! constructor
CGUISpinBox::CGUISpinBox(const wchar_t* text, IGUIEnvironment* environment,
IGUIElement* parent, s32 id, const core::rect<s32>& rectangle)
: IGUISpinBox(environment, parent, id, rectangle),
ButtonSpinUp(0), ButtonSpinDown(0),
StepSize(1.f), RangeMin(-FLT_MAX), RangeMax(FLT_MAX), FormatString(L"%f"), DecimalPlaces(-1)
{
s32 ButtonWidth = 16;
IGUISpriteBank *sb = 0;
if (environment && environment->getSkin())
{
ButtonWidth = environment->getSkin()->getSize(EGDS_SCROLLBAR_SIZE);
sb = environment->getSkin()->getSpriteBank();
}
ButtonSpinDown = Environment->addButton(
core::rect<s32>(rectangle.getWidth() - ButtonWidth, rectangle.getHeight()/2 +1,
rectangle.getWidth(), rectangle.getHeight()), this);
ButtonSpinDown->grab();
ButtonSpinDown->setSubElement(true);
ButtonSpinDown->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_CENTER, EGUIA_LOWERRIGHT);
ButtonSpinUp = Environment->addButton(
core::rect<s32>(rectangle.getWidth() - ButtonWidth, 0,
rectangle.getWidth(), rectangle.getHeight()/2), this);
ButtonSpinUp->grab();
ButtonSpinUp->setSubElement(true);
ButtonSpinUp->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_CENTER);
if (sb)
{
IGUISkin *skin = environment->getSkin();
ButtonSpinDown->setSpriteBank(sb);
ButtonSpinDown->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinDown->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinUp->setSpriteBank(sb);
ButtonSpinUp->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_UP), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinUp->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_UP), skin->getColor(EGDC_WINDOW_SYMBOL));
}
else
{
ButtonSpinDown->setText(L"-");
ButtonSpinUp->setText(L"+");
}
core::rect<s32> rectEdit(0, 0, rectangle.getWidth() - ButtonWidth - 1, rectangle.getHeight());
EditBox = Environment->addEditBox(text, rectEdit, true, this, -1);
EditBox->grab();
EditBox->setSubElement(true);
EditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
// verifyValueRange();
}
//! destructor
CGUISpinBox::~CGUISpinBox()
{
if (ButtonSpinUp)
ButtonSpinUp->drop();
if (ButtonSpinDown)
ButtonSpinDown->drop();
if (EditBox)
EditBox->drop();
}
IGUIEditBox* CGUISpinBox::getEditBox()
{
return EditBox;
}
void CGUISpinBox::setValue(f32 val)
{
wchar_t str[100];
#ifdef _IRR_WINDOWS_
_snwprintf(str, 99, FormatString.c_str(), val);
#else
swprintf(str, 99, FormatString.c_str(), val);
#endif
EditBox->setText(str);
verifyValueRange();
}
f32 CGUISpinBox::getValue()
{
const wchar_t* val = EditBox->getText();
if ( !val )
return 0.f;
core::stringc tmp(val);
return core::fast_atof(tmp.c_str());
}
void CGUISpinBox::setRange(f32 min, f32 max)
{
RangeMin = min;
RangeMax = max;
verifyValueRange();
}
f32 CGUISpinBox::getMin()
{
return RangeMin;
}
f32 CGUISpinBox::getMax()
{
return RangeMax;
}
f32 CGUISpinBox::getStepSize()
{
return StepSize;
}
void CGUISpinBox::setStepSize(f32 step)
{
StepSize = step;
}
//! Sets the number of decimal places to display.
void CGUISpinBox::setDecimalPlaces(s32 places)
{
DecimalPlaces = places;
if (places == -1)
FormatString = "%f";
else
{
FormatString = "%.";
FormatString += places;
FormatString += "f";
}
setValue(getValue());
}
bool CGUISpinBox::OnEvent(SEvent event)
{
bool changeEvent = false;
switch(event.EventType)
{
case EET_GUI_EVENT:
if (event.GUIEvent.EventType == EGET_BUTTON_CLICKED)
{
if (event.GUIEvent.Caller == ButtonSpinUp)
{
f32 val = getValue();
val += StepSize;
setValue(val);
changeEvent = true;
}
else if ( event.GUIEvent.Caller == ButtonSpinDown)
{
f32 val = getValue();
val -= StepSize;
setValue(val);
changeEvent = true;
}
}
if ( event.GUIEvent.EventType == EGET_EDITBOX_ENTER )
{
if (event.GUIEvent.Caller == EditBox)
{
verifyValueRange();
changeEvent = true;
}
}
break;
default:
break;
}
if ( changeEvent )
{
SEvent e;
e.EventType = EET_GUI_EVENT;
e.GUIEvent.Caller = this;
//fprintf(stderr, "EGET_SPINBOX_CHANGED caller:%p id: %d\n", e.GUIEvent.Caller, e.GUIEvent.Caller->getID() );
e.GUIEvent.EventType = EGET_SPINBOX_CHANGED;
if ( Parent )
Parent->OnEvent(e);
}
return false;
}
void CGUISpinBox::verifyValueRange()
{
f32 val = getValue();
if ( val < RangeMin )
val = RangeMin;
else if ( val > RangeMax )
val = RangeMax;
else
return;
setValue(val);
}
//! Sets the new caption of the element
void CGUISpinBox::setText(const wchar_t* text)
{
EditBox->setText(text);
setValue(getValue());
verifyValueRange();
}
//! Returns caption of this element.
const wchar_t* CGUISpinBox::getText()
{
return EditBox->getText();
}
//! Writes attributes of the element.
void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options)
{
IGUIElement::serializeAttributes(out, options);
out->addFloat("Min", getMin());
out->addFloat("Max", getMax());
out->addFloat("Step", getStepSize());
out->addInt("DecimalPlaces", DecimalPlaces);
}
//! Reads attributes of the element
void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IGUIElement::deserializeAttributes(in, options);
setRange(in->getAttributeAsFloat("Min"), in->getAttributeAsFloat("Max"));
setStepSize(in->getAttributeAsFloat("Step"));
setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces"));
}
} // end namespace gui
} // end namespace irr
// Copyright (C) 2006 Michael Zeilfelder
// This file uses the licence of the Irrlicht Engine.
#ifndef __C_GUI_SPIN_BOX_H_INCLUDED__
#define __C_GUI_SPIN_BOX_H_INCLUDED__
#include "IGUISpinBox.h"
namespace irr
{
namespace gui
{
class IGUIEditBox;
class IGUIButton;
class CGUISpinBox : public IGUISpinBox
{
public:
//! constructor
CGUISpinBox(const wchar_t* text, IGUIEnvironment* environment,
IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
//! destructor
~CGUISpinBox();
//! Access the edit box used in the spin control
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual IGUIEditBox* getEditBox();
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val);
//! Get the current value of the spinbox
virtual f32 getValue();
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
\param max: maximum value */
virtual void setRange(f32 min, f32 max);
//! get the minimum value which can be used in the spinbox
virtual f32 getMin();
//! get the maximum value which can be used in the spinbox
virtual f32 getMax();
//! step size by which values are changed when pressing the spin buttons
/** \param step: stepsize used for value changes when pressing spin buttons */
virtual void setStepSize(f32 step=1.f);
//! returns the step size
virtual f32 getStepSize();
//! called if an event happened.
virtual bool OnEvent(SEvent event);
//! Sets the new caption of the element
virtual void setText(const wchar_t* text);
//! Returns caption of this element.
virtual const wchar_t* getText();
//! Sets the number of decimal places to display.
/** \param places: The number of decimal places to display, use -1 to reset */
virtual void setDecimalPlaces(s32 places);
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
protected:
virtual void verifyValueRange();
core::stringw FormatString;
s32 DecimalPlaces;
IGUIEditBox * EditBox;
IGUIButton * ButtonSpinUp;
IGUIButton * ButtonSpinDown;
f32 StepSize;
f32 RangeMin;
f32 RangeMax;
};
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_SPIN_BOX_H_INCLUDED__
......@@ -20,7 +20,8 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
IGUIEnvironment* environment, IGUIElement* parent,
s32 id, const core::rect<s32>& rectangle,
bool background)
: IGUIStaticText(environment, parent, id, rectangle), Border(border),
: IGUIStaticText(environment, parent, id, rectangle), Border(border),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_UPPERLEFT),
OverrideColorEnabled(false), WordWrap(false), Background(background),
OverrideColor(video::SColor(101,255,255,255)), BGColor(video::SColor(101,210,210,210)),
OverrideFont(0), LastBreakFont(0)
......@@ -82,9 +83,22 @@ void CGUIStaticText::draw()
if (font)
{
if (!WordWrap)
{
if (VAlign == EGUIA_LOWERRIGHT)
{
frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y -
font->getDimension(L"A").Height - font->getKerningHeight();
}
if (HAlign == EGUIA_LOWERRIGHT)
{
frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
font->getDimension(Text.c_str()).Width;
}
font->draw(Text.c_str(), frameRect,
OverrideColorEnabled ? OverrideColor : skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
false, true, &AbsoluteClippingRect);
HAlign == EGUIA_CENTER, VAlign == EGUIA_CENTER, &AbsoluteClippingRect);
}
else
{
if (font != LastBreakFont)
......@@ -92,12 +106,27 @@ void CGUIStaticText::draw()
core::rect<s32> r = frameRect;
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
s32 totalHeight = height * BrokenText.size();
if (VAlign == EGUIA_CENTER)
{
r.UpperLeftCorner.Y = r.getCenter().Y - (totalHeight / 2);
}
else if (VAlign == EGUIA_LOWERRIGHT)
{
r.UpperLeftCorner.Y = r.LowerRightCorner.Y - totalHeight;
}
for (u32 i=0; i<BrokenText.size(); ++i)
{
if (HAlign == EGUIA_LOWERRIGHT)
{
r.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
font->getDimension(BrokenText[i].c_str()).Width;
}
font->draw(BrokenText[i].c_str(), r,
OverrideColorEnabled ? OverrideColor : skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
false, false, &AbsoluteClippingRect);
HAlign == EGUIA_CENTER, false, &AbsoluteClippingRect);
r.LowerRightCorner.Y += height;
r.UpperLeftCorner.Y += height;
......@@ -125,7 +154,7 @@ void CGUIStaticText::setOverrideFont(IGUIFont* font)
breakText();
}
IGUIFont * CGUIStaticText::getOverrideFont(void)
IGUIFont * CGUIStaticText::getOverrideFont()
{
return OverrideFont;
}
......@@ -151,7 +180,20 @@ void CGUIStaticText::setDrawBackground(bool draw)
Background = draw;
}
video::SColor const & CGUIStaticText::getOverrideColor(void)
//! Sets whether to draw the border
void CGUIStaticText::setDrawBorder(bool draw)
{
Border = draw;
}
void CGUIStaticText::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
HAlign = horizontal;
VAlign = vertical;
}
video::SColor const & CGUIStaticText::getOverrideColor()
{
return OverrideColor;
}
......@@ -164,7 +206,7 @@ void CGUIStaticText::enableOverrideColor(bool enable)
OverrideColorEnabled = enable;
}
bool CGUIStaticText::isOverrideColorEnabled(void)
bool CGUIStaticText::isOverrideColorEnabled()
{
return OverrideColorEnabled;
}
......@@ -178,7 +220,7 @@ void CGUIStaticText::setWordWrap(bool enable)
breakText();
}
bool CGUIStaticText::isWordWrapEnabled(void)
bool CGUIStaticText::isWordWrapEnabled()
{
return WordWrap;
}
......@@ -294,6 +336,12 @@ void CGUIStaticText::setText(const wchar_t* text)
breakText();
}
void CGUIStaticText::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
breakText();
}
//! Returns the height of the text in pixels when it is drawn.
s32 CGUIStaticText::getTextHeight()
......@@ -319,7 +367,7 @@ s32 CGUIStaticText::getTextHeight()
}
s32 CGUIStaticText::getTextWidth(void)
s32 CGUIStaticText::getTextWidth()
{
IGUIFont * font = OverrideFont;
......@@ -360,16 +408,17 @@ s32 CGUIStaticText::getTextWidth(void)
//! scripting languages, editors, debuggers or xml serialization purposes.
void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
IGUIStaticText::serializeAttributes(out,options);
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled", OverrideColorEnabled);
out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
out->addColor ("OverrideColor", OverrideColor);
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled", OverrideColorEnabled);
out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
out->addColor ("OverrideColor", OverrideColor);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
// out->addFont ("OverrideFont", OverrideFont);
IGUIStaticText::serializeAttributes(out,options);
}
//! Reads attributes of the element
......@@ -385,6 +434,9 @@ void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
setWordWrap(in->getAttributeAsBool("WordWrap"));
Background = in->getAttributeAsBool("Background");
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
// OverrideFont = in->getAttributeAsFont("OverrideFont");
}
......
......@@ -31,7 +31,7 @@ namespace gui
virtual void setOverrideFont(IGUIFont* font=0);
//! Gets the override font (if any)
virtual IGUIFont * getOverrideFont(void);
virtual IGUIFont * getOverrideFont();
//! Sets another color for the text.
virtual void setOverrideColor(video::SColor color);
......@@ -42,22 +42,28 @@ namespace gui
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw);
//! Sets whether to draw the border
virtual void setDrawBorder(bool draw);
//! Sets alignment mode for text
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
//! Gets the override color
virtual video::SColor const & getOverrideColor(void);
virtual video::SColor const & getOverrideColor();
//! Sets if the static text should use the overide color or the
//! color in the gui skin.
virtual void enableOverrideColor(bool enable);
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void);
virtual bool isOverrideColorEnabled();
//! Enables or disables word wrap for using the static text as
//! multiline text control.
virtual void setWordWrap(bool enable);
//! Checks if word wrap is enabled
virtual bool isWordWrapEnabled(void);
virtual bool isWordWrapEnabled();
//! Sets the new caption of this element.
virtual void setText(const wchar_t* text);
......@@ -66,7 +72,10 @@ namespace gui
virtual s32 getTextHeight();
//! Returns the width of the current text, in the current font
virtual s32 getTextWidth(void);
virtual s32 getTextWidth();
//! Updates the absolute position, splits text if word wrap is enabled
virtual void updateAbsolutePosition();
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);
......@@ -80,6 +89,7 @@ namespace gui
void breakText();
bool Border;
EGUI_ALIGNMENT HAlign, VAlign;
bool OverrideColorEnabled;
bool WordWrap;
bool Background;
......
......@@ -9,7 +9,7 @@ CppCompiler=-D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -D_USRDLL -DIR
Includes=..\..\include;zlib
Linker=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lglu32 -lopengl32_@@_
Libs=
UnitCount=580
UnitCount=583
Folders=doc,gui_impl,include,include/core,include/gui,include/io,include/scene,include/video,io_impl,other_impl,other_impl/extern,other_impl/extern/jpeglib,other_impl/extern/libpng,other_impl/extern/zlib,scene_impl,video_impl,"video_impl/Burning Video",video_impl/DirectX8,video_impl/DirectX9,video_impl/Null,video_impl/OpenGL,video_impl/Software
ObjFiles=
PrivateResource=
......@@ -5847,3 +5847,33 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit581]
FileName=CGUISpinBox.h
CompileCpp=1
Folder=gui_impl
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit582]
FileName=CGUISpinBox.cpp
CompileCpp=1
Folder=gui_impl
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit583]
FileName=..\..\include\IGUISpinBox.h
CompileCpp=1
Folder=include/gui
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
......@@ -694,6 +694,9 @@
<File
RelativePath=".\..\..\include\IGUIScrollBar.h">
</File>
<File
RelativePath=".\..\..\include\IGUISpinBox.h">
</File>
<File
RelativePath=".\..\..\include\IGUISkin.h">
</File>
......@@ -828,6 +831,12 @@
<File
RelativePath=".\CGUIScrollBar.h">
</File>
<File
RelativePath="CGUISpinBox.cpp">
</File>
<File
RelativePath="CGUISpinBox.h">
</File>
<File
RelativePath=".\CGUISkin.cpp">
</File>
......
......@@ -800,6 +800,10 @@
RelativePath=".\..\..\include\IGUISkin.h"
>
</File>
<File
RelativePath="..\..\include\IGUISpinBox.h"
>
</File>
<File
RelativePath="..\..\include\IGUISpriteBank.h"
>
......@@ -977,6 +981,14 @@
RelativePath=".\CGUISkin.h"
>
</File>
<File
RelativePath=".\CGUISpinBox.cpp"
>
</File>
<File
RelativePath=".\CGUISpinBox.h"
>
</File>
<File
RelativePath=".\CGUISpriteBank.cpp"
>
......@@ -1124,6 +1136,14 @@
RelativePath=".\COpenGLDriver.h"
>
</File>
<File
RelativePath=".\COpenGLExtensionHandler.cpp"
>
</File>
<File
RelativePath=".\COpenGLExtensionHandler.h"
>
</File>
<File
RelativePath=".\COpenGLMaterialRenderer.h"
>
......@@ -1168,14 +1188,6 @@
RelativePath=".\COpenGLTexture.h"
>
</File>
<File
RelativePath=".\COpenGLExtensionHandler.cpp"
>
</File>
<File
RelativePath=".\COpenGLExtensionHandler.h"
>
</File>
<File
RelativePath=".\glext.h"
>
......
......@@ -292,6 +292,12 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="..\..\include\IGUISpinBox.h">
<Option compilerVar=""/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="..\..\include\IGUISpriteBank.h">
<Option compilerVar=""/>
<Option compile="0"/>
......@@ -1412,6 +1418,16 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="CGUISpinBox.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
<Unit filename="CGUISpinBox.h">
<Option compilerVar=""/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="CGUISpriteBank.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
......@@ -1844,6 +1860,16 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="COpenGLExtensionHandler.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
<Unit filename="COpenGLExtensionHandler.h">
<Option compilerVar="CPP"/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="COpenGLMaterialRenderer.h">
<Option compilerVar="CPP"/>
<Option compile="0"/>
......@@ -1900,16 +1926,6 @@
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="COpenGLExtensionHandler.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
<Unit filename="COpenGLExtensionHandler.h">
<Option compilerVar="CPP"/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="CPakReader.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
......
......@@ -24,7 +24,7 @@ IRRVIDEOOBJ = COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRende
IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o
IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryReadFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CZipReader.o CPakReader.o irrXML.o CAttributes.o
IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceStub.o CIrrDeviceWin32.o CLogger.o COSOperator.o Irrlicht.o os.o
IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o
IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o
ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o
JPEGLIBOBJ = jpeglib/jcapimin.o jpeglib/jcapistd.o jpeglib/jccoefct.o jpeglib/jccolor.o jpeglib/jcdctmgr.o jpeglib/jchuff.o jpeglib/jcinit.o jpeglib/jcmainct.o jpeglib/jcmarker.o jpeglib/jcmaster.o jpeglib/jcomapi.o jpeglib/jcparam.o jpeglib/jcphuff.o jpeglib/jcprepct.o jpeglib/jcsample.o jpeglib/jctrans.o jpeglib/jdapimin.o jpeglib/jdapistd.o jpeglib/jdatadst.o jpeglib/jdatasrc.o jpeglib/jdcoefct.o jpeglib/jdcolor.o jpeglib/jddctmgr.o jpeglib/jdhuff.o jpeglib/jdinput.o jpeglib/jdmainct.o jpeglib/jdmarker.o jpeglib/jdmaster.o jpeglib/jdmerge.o jpeglib/jdphuff.o jpeglib/jdpostct.o jpeglib/jdsample.o jpeglib/jdtrans.o jpeglib/jerror.o jpeglib/jfdctflt.o jpeglib/jfdctfst.o jpeglib/jfdctint.o jpeglib/jidctflt.o jpeglib/jidctfst.o jpeglib/jidctint.o jpeglib/jidctred.o jpeglib/jmemmgr.o jpeglib/jmemnobs.o jpeglib/jquant1.o jpeglib/jquant2.o jpeglib/jutils.o jpeglib/rdbmp.o jpeglib/rdcolmap.o jpeglib/rdgif.o jpeglib/rdppm.o jpeglib/rdrle.o jpeglib/rdswitch.o jpeglib/rdtarga.o jpeglib/transupp.o jpeglib/wrbmp.o jpeglib/wrgif.o jpeglib/wrppm.o jpeglib/wrrle.o jpeglib/wrtarga.o
LIBPNGOBJ = libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngpread.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libpng/pngwio.o libpng/pngwrite.o libpng/pngwtran.o libpng/pngwutil.o
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment