* removed trailing whitespaces

This commit is contained in:
Martin Gerhardy 2010-11-12 08:25:36 +01:00
parent d4471cfb33
commit 8e03f797be
112 changed files with 2148 additions and 2148 deletions

View file

@ -929,7 +929,7 @@ void HandleActionResource(CUnit &unit)
if (unit.SubAction == SUB_STOP_GATHERING) {
if (StopGathering(unit)) {
unit.SubAction = SUB_MOVE_TO_DEPOT;
unit.Data.Move.Cycles = 0;; //moving counter
unit.Data.Move.Cycles = 0 //moving counter
} else
return;
}

View file

@ -77,16 +77,16 @@ static void MapMarkUnitGuard(CUnit &unit)
if (!unit.Removed) {
unit.GuardLock = 1;
MapSight(unit.Player, unit.tilePos.x, unit.tilePos.y,
unit.Type->TileWidth, unit.Type->TileHeight,
unit.GetReactRange(),
MapMarkTileGuard);
unit.Type->TileWidth, unit.Type->TileHeight,
unit.GetReactRange(),
MapMarkTileGuard);
} else {
CUnit *c = unit.Container;
if (c && c->Type->AttackFromTransporter) {
unit.GuardLock = 1;
MapSight(unit.Player, c->tilePos.x, c->tilePos.y,
c->Type->TileWidth, c->Type->TileHeight,
unit.GetReactRange(), MapMarkTileGuard);
c->Type->TileWidth, c->Type->TileHeight,
unit.GetReactRange(), MapMarkTileGuard);
}
}
}
@ -98,15 +98,15 @@ void MapUnmarkUnitGuard(CUnit &unit)
if (!unit.Removed) {
unit.GuardLock = 0;
MapSight(unit.Player, unit.tilePos.x, unit.tilePos.y,
unit.Type->TileWidth, unit.Type->TileHeight,
unit.GetReactRange(), MapUnmarkTileGuard);
unit.Type->TileWidth, unit.Type->TileHeight,
unit.GetReactRange(), MapUnmarkTileGuard);
} else {
CUnit *c = unit.Container;
if (c && c->Type->AttackFromTransporter) {
unit.GuardLock = 0;
MapSight(unit.Player, c->tilePos.x, c->tilePos.y,
c->Type->TileWidth, c->Type->TileHeight,
unit.GetReactRange(), MapUnmarkTileGuard);
c->Type->TileWidth, c->Type->TileHeight,
unit.GetReactRange(), MapUnmarkTileGuard);
}
}
}
@ -311,7 +311,7 @@ void AutoAttack(CUnit &unit, CUnitCache &targets, bool stand_ground)
// Normal units react in reaction range.
if (!stand_ground && !unit.Removed && unit.CanMove()) {
if ((goal = AutoAttackUnitsInDistance(unit,
unit.GetReactRange(), targets))) {
unit.GetReactRange(), targets))) {
// Weak goal, can choose other unit, come back after attack
CommandAttack(unit, goal->tilePos.x, goal->tilePos.y, NULL, FlushCommands);
Assert(unit.SavedOrder.Action == UnitActionStill);

View file

@ -661,11 +661,11 @@ void UnitActions()
if (!logf) {
return;
}
fprintf(logf, ";;; Log file generated by Stratagus Version "
fprintf(logf, "; Log file generated by Stratagus Version "
VERSION "\n");
time(&now);
fprintf(logf, ";;;\tDate: %s", ctime(&now));
fprintf(logf, ";;;\tMap: %s\n\n", Map.Info.Description.c_str());
fprintf(logf, ";\tDate: %s", ctime(&now));
fprintf(logf, ";\tMap: %s\n\n", Map.Info.Description.c_str());
}
fprintf(logf, "%lu: ", GameCycle);

View file

@ -777,9 +777,9 @@ void AiHelpMe(const CUnit *attacker, CUnit &defender)
// FIXME ad support for help from Coward type units
if (aiunit->IsAgressive() && (aiunit->IsIdle() ||
!(aiunit->CurrentAction() == UnitActionAttack &&
aiunit->CurrentOrder()->HasGoal() &&
aiunit->CurrentOrder()->GetGoal()->IsAgressive()))
&& CanTarget(aiunit->Type, attacker->Type)) {
aiunit->CurrentOrder()->HasGoal() &&
aiunit->CurrentOrder()->GetGoal()->IsAgressive()))
&& CanTarget(aiunit->Type, attacker->Type)) {
if (aiunit->SavedOrder.Action == UnitActionStill) {
// FIXME: should rewrite command handling

View file

@ -215,7 +215,7 @@ static int AiFindBuildingPlace2(const CUnit &worker, const CUnitType *type,
//
// Pop a point from stack, push all neighbours which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rpos = points[rp];
for (i = 0; i < 8; ++i) { // mark all neighbors
@ -338,7 +338,7 @@ static int AiFindHallPlace(const CUnit &worker,
//
// Pop a point from stack, push all neighbors which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rpos = points[rp];
for (i = 0; i < 8; ++i) { // mark all neighbors
@ -483,7 +483,7 @@ static int AiFindLumberMillPlace(const CUnit &worker, const CUnitType *type,
//
// Pop a point from stack, push all neightbors which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rpos = points[rp];
for (i = 0; i < 8; ++i) { // mark all neighbors
@ -578,7 +578,7 @@ static int AiFindMiningPlace(const CUnit &worker,
//
// Pop a point from stack, push all neighbors which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rpos = points[rp];
for (i = 0; i < 8; ++i) { // mark all neighbors

View file

@ -162,7 +162,7 @@ static void AiMarkWaterTransporter(const CUnit &unit, unsigned char *matrix)
//
// Pop a point from stack, push all neightbors which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rx = points[rp].X;
ry = points[rp].Y;
@ -260,7 +260,7 @@ static bool AiFindTarget(const CUnit &unit,
//
// Pop a point from stack, push all neightbors which could be entered.
//
for (;;) {
for () {
while (rp != ep) {
rpos = points[rp].pos;
state = points[rp].State;

View file

@ -1256,7 +1256,7 @@ static void EditorCallbackButtonDown(unsigned button)
return;
case UnitButton:
Editor.State = EditorEditUnit;
if (VisibleUnitIcons < (int)Editor.ShownUnitTypes.size()) {
if (VisibleUnitIcons < (int)Editor.ShownUnitTypes.size()) {
editorUnitSlider->setVisible(true);
}
editorSlider->setVisible(false);
@ -1266,7 +1266,7 @@ static void EditorCallbackButtonDown(unsigned button)
Editor.State = EditorEditTile;
}
editorUnitSlider->setVisible(false);
if (VisibleTileIcons < (int)Editor.ShownTileTypes.size()) {
if (VisibleTileIcons < (int)Editor.ShownTileTypes.size()) {
editorSlider->setVisible(true);
}
return;
@ -1358,9 +1358,9 @@ static void EditorCallbackButtonDown(unsigned button)
return;
} else if (Editor.State == EditorEditTile &&
Editor.SelectedTileIndex != -1) {
Editor.SelectedTileIndex = -1;
CursorBuilding = NULL;
return;
Editor.SelectedTileIndex = -1;
CursorBuilding = NULL;
return;
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/cliprectangle.h"
@ -64,7 +64,7 @@ namespace gcn
{
x = y = width = height = xOffset = yOffset = 0;
}
ClipRectangle::ClipRectangle(int x, int y, int width, int height, int xOffset, int yOffset)
{
this->x = x;
@ -74,7 +74,7 @@ namespace gcn
this->xOffset = xOffset;
this->yOffset = yOffset;
}
const ClipRectangle& ClipRectangle::operator=(const Rectangle& other)
{
x = other.x;

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/color.h"
@ -73,9 +73,9 @@ namespace gcn
a = 255;
r = (color >> 16) & 0xFF;
g = (color >> 8) & 0xFF;
b = color & 0xFF;
b = color & 0xFF;
}
Color::Color(int r, int g, int b, int a)
{
this->r = r;
@ -98,7 +98,7 @@ namespace gcn
return result;
}
Color Color::operator-(const Color& color) const
{
Color result;
@ -126,7 +126,7 @@ namespace gcn
result.g = (result.g>255?255:(result.g<0?0:result.g));
result.b = (result.b>255?255:(result.b<0?0:result.b));
return result;
return result;
}
bool Color::operator==(const Color& color) const

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,14 +53,14 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/defaultfont.h"
#include "guichan/rectangle.h"
namespace gcn
{
{
int DefaultFont::getHeight() const
{
return 8;
@ -74,19 +74,19 @@ namespace gcn
int DefaultFont::drawGlyph(Graphics* graphics, unsigned char, int x, int y)
{
graphics->drawRectangle( Rectangle(x, y, 8, 8));
return 8;
return 8;
}
void DefaultFont::drawString(Graphics* graphics, const std::string& text, int x, int y)
{
unsigned int i;
for (i = 0; i< text.size(); ++i)
{
drawGlyph(graphics, text.at(i), x, y);
x += getWidth(text);
}
x += getWidth(text);
}
}
int DefaultFont::getStringIndexAt(const std::string& text, int x)
@ -95,7 +95,7 @@ namespace gcn
{
return text.size();
}
return x / 8;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/exception.h"
@ -85,12 +85,12 @@ namespace gcn
{
return mFunction;
}
const std::string& Exception::getMessage() const
{
return mMessage;
}
const std::string& Exception::getFilename() const
{
return mFilename;
@ -99,5 +99,5 @@ namespace gcn
int Exception::getLine() const
{
return mLine;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <ctype.h> // for isascii
@ -66,7 +66,7 @@ namespace gcn
FocusHandler::FocusHandler()
{
mFocusedWidget = NULL;
mDraggedWidget = NULL;
mDraggedWidget = NULL;
mToBeFocused = NULL;
mToBeDragged = NULL;
mModalFocusedWidget = NULL;
@ -74,7 +74,7 @@ namespace gcn
void FocusHandler::requestFocus(Widget* widget)
{
mToBeFocused = widget;
mToBeFocused = widget;
}
void FocusHandler::setFocus(Widget* widget)
@ -115,7 +115,7 @@ namespace gcn
mModalFocusedWidget = NULL;
}
}
Widget* FocusHandler::getFocused() const
{
return mFocusedWidget;
@ -130,7 +130,7 @@ namespace gcn
{
return mModalFocusedWidget;
}
void FocusHandler::focusNext()
{
int i;
@ -143,83 +143,25 @@ namespace gcn
}
}
int focused = focusedWidget;
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
i = (int)mWidgets.size();
do
{
++focusedWidget;
if (i==0)
{
focusedWidget = -1;
break;
}
--i;
if (focusedWidget >= (int)mWidgets.size())
{
focusedWidget = 0;
}
if (focusedWidget == focused)
{
return;
}
}
while (!mWidgets.at(focusedWidget)->isFocusable());
if (focusedWidget >= 0)
{
mFocusedWidget = mWidgets.at(focusedWidget);
mWidgets.at(focusedWidget)->gotFocus();
}
if (focused >= 0)
{
mWidgets.at(focused)->lostFocus();
}
}
void FocusHandler::focusPrevious()
{
if (mWidgets.size() == 0)
{
mFocusedWidget = NULL;
return;
}
int i;
int focusedWidget = -1;
for (i = 0; i < (int)mWidgets.size(); ++i)
{
if (mWidgets[i] == mFocusedWidget)
{
focusedWidget = i;
}
}
int focused = focusedWidget;
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
i = (int)mWidgets.size();
do
{
--focusedWidget;
if (i==0)
{
focusedWidget = -1;
break;
}
--i;
if (focusedWidget <= 0)
{
focusedWidget = mWidgets.size() - 1;
focusedWidget = 0;
}
if (focusedWidget == focused)
@ -234,11 +176,69 @@ namespace gcn
mFocusedWidget = mWidgets.at(focusedWidget);
mWidgets.at(focusedWidget)->gotFocus();
}
if (focused >= 0)
{
mWidgets.at(focused)->lostFocus();
}
}
}
void FocusHandler::focusPrevious()
{
if (mWidgets.size() == 0)
{
mFocusedWidget = NULL;
return;
}
int i;
int focusedWidget = -1;
for (i = 0; i < (int)mWidgets.size(); ++i)
{
if (mWidgets[i] == mFocusedWidget)
{
focusedWidget = i;
}
}
int focused = focusedWidget;
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
i = (int)mWidgets.size();
do
{
--focusedWidget;
if (i==0)
{
focusedWidget = -1;
break;
}
--i;
if (focusedWidget <= 0)
{
focusedWidget = mWidgets.size() - 1;
}
if (focusedWidget == focused)
{
return;
}
}
while (!mWidgets.at(focusedWidget)->isFocusable());
if (focusedWidget >= 0)
{
mFocusedWidget = mWidgets.at(focusedWidget);
mWidgets.at(focusedWidget)->gotFocus();
}
if (focused >= 0)
{
mWidgets.at(focused)->lostFocus();
}
}
bool FocusHandler::hasFocus(const Widget* widget) const
@ -253,9 +253,9 @@ namespace gcn
void FocusHandler::add(Widget* widget)
{
mWidgets.push_back(widget);
mWidgets.push_back(widget);
}
void FocusHandler::remove(Widget* widget)
{
if (widget == mFocusedWidget)
@ -280,32 +280,32 @@ namespace gcn
mFocusedWidget = NULL;
mToBeFocused = NULL;
}
int i = 0;
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
++i;
if ((*iter) == widget)
{
mWidgets.erase(iter);
{
mWidgets.erase(iter);
return;
}
}
}
}
}
void FocusHandler::focusNone()
{
if (mFocusedWidget != NULL)
{
Widget* focused = mFocusedWidget;
mFocusedWidget = NULL;
focused->lostFocus();
mFocusedWidget = NULL;
focused->lostFocus();
}
mToBeFocused = NULL;
}
@ -345,7 +345,7 @@ namespace gcn
}
}
}
void FocusHandler::tabNext()
{
if (mFocusedWidget != NULL)
@ -360,7 +360,7 @@ namespace gcn
{
mFocusedWidget = NULL;
return;
}
}
int i;
int focusedWidget = -1;
@ -371,34 +371,34 @@ namespace gcn
focusedWidget = i;
}
}
int focused = focusedWidget;
int focused = focusedWidget;
bool done = false;
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
i = (int)mWidgets.size();
do
{
++focusedWidget;
if (i==0)
{
focusedWidget = -1;
break;
}
--i;
if (focusedWidget >= (int)mWidgets.size())
{
focusedWidget = 0;
focusedWidget = 0;
}
if (focusedWidget == focused)
{
return;
}
if (mWidgets.at(focusedWidget)->isFocusable() &&
mWidgets.at(focusedWidget)->isTabInEnabled() &&
(mModalFocusedWidget == NULL ||
@ -414,7 +414,7 @@ namespace gcn
mFocusedWidget = mWidgets.at(focusedWidget);
mWidgets.at(focusedWidget)->gotFocus();
}
if (focused >= 0)
{
mWidgets.at(focused)->lostFocus();
@ -430,12 +430,12 @@ namespace gcn
return;
}
}
if (mWidgets.size() == 0)
{
mFocusedWidget = NULL;
return;
}
}
int i;
int focusedWidget = -1;
@ -446,9 +446,9 @@ namespace gcn
focusedWidget = i;
}
}
int focused = focusedWidget;
int focused = focusedWidget;
bool done = false;
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
i = (int)mWidgets.size();
@ -463,10 +463,10 @@ namespace gcn
}
--i;
if (focusedWidget <= 0)
{
focusedWidget = mWidgets.size() - 1;
focusedWidget = mWidgets.size() - 1;
}
if (focusedWidget == focused)
@ -488,12 +488,12 @@ namespace gcn
{
mFocusedWidget = mWidgets.at(focusedWidget);
mWidgets.at(focusedWidget)->gotFocus();
}
}
if (focused >= 0)
{
mWidgets.at(focused)->lostFocus();
}
}
}
void FocusHandler::applyChanges()
@ -503,14 +503,14 @@ namespace gcn
unsigned int i = 0;
int toBeFocusedIndex = -1;
for (i = 0; i < mWidgets.size(); ++i)
{
{
if (mWidgets[i] == mToBeFocused)
{
toBeFocusedIndex = i;
break;
break;
}
}
}
if (toBeFocusedIndex < 0)
{
assert(!"Trying to focus a none existing widget.");
@ -522,12 +522,12 @@ namespace gcn
if (oldFocused != mToBeFocused)
{
mFocusedWidget = mWidgets.at(toBeFocusedIndex);
if (oldFocused != NULL)
{
oldFocused->lostFocus();
}
mWidgets.at(toBeFocusedIndex)->gotFocus();
}
mToBeFocused = NULL;
@ -538,22 +538,22 @@ namespace gcn
unsigned int i = 0;
int toBeDraggedIndex = -1;
for (i = 0; i < mWidgets.size(); ++i)
{
{
if (mWidgets[i] == mToBeDragged)
{
toBeDraggedIndex = i;
toBeDraggedIndex = i;
break;
}
}
}
if (toBeDraggedIndex < 0)
{
assert(!"Trying to give drag to a none existing widget.");
//throw GCN_EXCEPTION("Trying to give drag to a none existing widget");
}
mDraggedWidget = mWidgets.at(toBeDraggedIndex);
mToBeDragged = NULL;
mToBeDragged = NULL;
}
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,14 +53,14 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/font.h"
#include "guichan/exception.h"
namespace gcn
{
{
static int GetNext(const std::string &text, int curpos)
{
char c = text[curpos];
@ -83,7 +83,7 @@ namespace gcn
unsigned int i;
unsigned int nexti;
int size = 0;
i = 0;
while (i < text.size())
{
@ -96,7 +96,7 @@ namespace gcn
}
i = nexti;
}
return text.size();
return text.size();
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/graphics.h"
@ -65,9 +65,9 @@ namespace gcn
Graphics::Graphics()
{
mFont = NULL;
mFont = NULL;
}
bool Graphics::pushClipArea(Rectangle area)
{
if (mClipStack.empty())
@ -98,14 +98,14 @@ namespace gcn
void Graphics::popClipArea()
{
if (mClipStack.empty())
{
assert(!"Tried to pop clip area from empty stack.");
//throw GCN_EXCEPTION("Tried to pop clip area from empty stack.");
}
}
mClipStack.pop();
mClipStack.pop();
}
const ClipRectangle& Graphics::getCurrentClipArea()
@ -115,18 +115,18 @@ namespace gcn
assert(!"The clip area stack is empty.");
//throw GCN_EXCEPTION("The clip area stack is empty.");
}
return mClipStack.top();
}
void Graphics::drawImage(const Image* image, int dstX, int dstY)
{
drawImage(image, 0, 0, dstX, dstY, image->getWidth(), image->getHeight());
drawImage(image, 0, 0, dstX, dstY, image->getWidth(), image->getHeight());
}
void Graphics::setFont(Font* font)
{
mFont = font;
mFont = font;
}
void Graphics::drawText(const std::string& text, int x, int y,
@ -140,7 +140,7 @@ namespace gcn
switch (alignment)
{
case LEFT:
case LEFT:
mFont->drawString(this, text, x, y);
break;
case CENTER:
@ -152,6 +152,6 @@ namespace gcn
default:
assert(!"Unknown alignment.");
//throw GCN_EXCEPTION("Unknown alignment.");
}
}
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/exception.h"
@ -80,10 +80,10 @@ namespace gcn
{
setTop(NULL);
}
delete mFocusHandler;
}
void Gui::setTop(Widget* top)
{
if (mTop)
@ -95,7 +95,7 @@ namespace gcn
top->_setFocusHandler(mFocusHandler);
top->setDirty(true);
}
mTop = top;
}
@ -118,7 +118,7 @@ namespace gcn
{
mInput = input;
}
Input* Gui::getInput() const
{
return mInput;
@ -157,7 +157,7 @@ namespace gcn
else if (mTop->hasMouse())
{
mTop->_mouseOutMessage();
}
}
Widget* f = mFocusHandler->getFocused();
Widget* d = mFocusHandler->getDragged();
@ -168,11 +168,11 @@ namespace gcn
{
int xOffset, yOffset;
f->getAbsolutePosition(xOffset, yOffset);
MouseInput mio = mi;
mio.x -= xOffset;
mio.y -= yOffset;
f->_mouseInputMessage(mio);
}
@ -182,19 +182,19 @@ namespace gcn
{
int xOffset, yOffset;
d->getAbsolutePosition(xOffset, yOffset);
MouseInput mio = mi;
mio.x -= xOffset;
mio.y -= yOffset;
d->_mouseInputMessage(mio);
d->_mouseInputMessage(mio);
}
mFocusHandler->applyChanges();
} // end while
while (!mInput->isKeyQueueEmpty())
while (!mInput->isKeyQueueEmpty())
{
KeyInput ki = mInput->dequeueKeyInput();
@ -216,7 +216,7 @@ namespace gcn
bool keyProcessed = false;
// Send key inputs to the focused widgets
if (mFocusHandler->getFocused())
if (mFocusHandler->getFocused())
{
if (mFocusHandler->getFocused()->isFocusable())
{
@ -233,14 +233,14 @@ namespace gcn
mFocusHandler->checkHotKey(ki);
}
}
mFocusHandler->applyChanges();
} // end while
} // end if
mTop->logic();
mTop->logic();
}
void Gui::draw(Widget* top)
@ -268,21 +268,21 @@ namespace gcn
rec.x -= top->getBorderSize();
rec.y -= top->getBorderSize();
rec.width += 2 * top->getBorderSize();
rec.height += 2 * top->getBorderSize();
rec.height += 2 * top->getBorderSize();
mGraphics->pushClipArea(rec);
top->drawBorder(mGraphics);
mGraphics->popClipArea();
}
mGraphics->pushClipArea(top->getDimension());
mGraphics->pushClipArea(top->getDimension());
top->draw(mGraphics);
top->setDirty(false);
mGraphics->popClipArea();
mGraphics->_endDraw();
mGraphics->_endDraw();
}
}
void Gui::draw()
{
draw(mTop);
@ -297,7 +297,7 @@ namespace gcn
{
mTabbing = tabbing;
}
bool Gui::isTabbingEnabled()
{
return mTabbing;

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
extern "C"

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/image.h"
@ -68,7 +68,7 @@ namespace gcn
{
mLoadedWithImageLoader = false;
}
Image::Image(void* data, int width, int height)
{
mData = data;
@ -76,7 +76,7 @@ namespace gcn
mHeight = height;
mLoadedWithImageLoader = false;
}
Image::Image(const std::string& filename)
{
if (mImageLoader == NULL)
@ -86,7 +86,7 @@ namespace gcn
}
mLoadedWithImageLoader = true;
mImageLoader->prepare(filename);
mImageLoader->prepare(filename);
mWidth = mImageLoader->getWidth();
mHeight = mImageLoader->getHeight();
mData = mImageLoader->finalize();
@ -99,7 +99,7 @@ namespace gcn
mImageLoader->free(this);
}
}
int Image::getWidth() const
{
return mWidth;
@ -114,14 +114,14 @@ namespace gcn
{
return mData;
}
void Image::setImageLoader(ImageLoader* imageLoader)
{
{
mImageLoader = imageLoader;
}
ImageLoader* Image::_getImageLoader()
{
return mImageLoader;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <sstream>
@ -73,22 +73,22 @@ namespace gcn
}
ImageLoader* imageLoader = Image::_getImageLoader();
mFilename = filename;
mFilename = filename;
Image::_getImageLoader()->prepare(filename);
Color separator = Image::_getImageLoader()->getPixel(0, 0);
int i = 0;
for (i=0; separator == imageLoader->getPixel(i, 0)
&& i < imageLoader->getWidth(); ++i)
{
{
}
if (i >= imageLoader->getWidth())
{
assert(!"Corrupt image.");
//throw GCN_EXCEPTION("Corrupt image.");
}
int j = 0;
for (j = 0; j < imageLoader->getHeight(); ++j)
{
@ -96,25 +96,25 @@ namespace gcn
{
break;
}
}
}
mHeight = j;
int x = 0, y = 0;
unsigned char k;
for (i=0; i < (int)glyphs.size(); ++i)
for (i=0; i < (int)glyphs.size(); ++i)
{
k = glyphs.at(i);
addGlyph(k, x, y, separator);
}
int w = imageLoader->getWidth();
int h = imageLoader->getHeight();
void* data = imageLoader->finalize();
mImage = new Image(data, w, h);
mRowSpacing = 0;
mGlyphSpacing = 0;
mGlyphSpacing = 0;
}
ImageFont::ImageFont(const std::string& filename, unsigned char glyphsFrom, unsigned char glyphsTo)
@ -126,22 +126,22 @@ namespace gcn
}
ImageLoader* imageLoader = Image::_getImageLoader();
mFilename = filename;
mFilename = filename;
Image::_getImageLoader()->prepare(filename);
Color separator = Image::_getImageLoader()->getPixel(0, 0);
int i = 0;
for (i=0; separator == imageLoader->getPixel(i, 0)
&& i < imageLoader->getWidth(); ++i)
{
{
}
if (i >= imageLoader->getWidth())
{
assert(!"Corrupt image.");
assert(!"Corrupt image.");
//throw GCN_EXCEPTION("Corrupt image.");
}
int j = 0;
for (j = 0; j < imageLoader->getHeight(); ++j)
{
@ -149,38 +149,38 @@ namespace gcn
{
break;
}
}
}
mHeight = j;
int x = 0, y = 0;
for (i=glyphsFrom; i<glyphsTo+1; i++)
{
addGlyph(i, x, y, separator);
addGlyph(i, x, y, separator);
}
int w = imageLoader->getWidth();
int h = imageLoader->getHeight();
void* data = imageLoader->finalize();
mImage = new Image(data, w, h);
mRowSpacing = 0;
mGlyphSpacing = 0;
mGlyphSpacing = 0;
}
ImageFont::~ImageFont()
{
Image::_getImageLoader()->free(mImage);
delete mImage;
delete mImage;
}
int ImageFont::getWidth(unsigned char glyph) const
{
if (mGlyph[glyph].width == 0)
{
{
return mGlyph[(int)(' ')].width + mGlyphSpacing;
}
return mGlyph[glyph].width + mGlyphSpacing;
}
@ -193,30 +193,30 @@ namespace gcn
{
// This is needed for drawing the Glyph in the middle if we have spacing
int yoffset = getRowSpacing() >> 1;
if (mGlyph[glyph].width == 0)
{
graphics->drawRectangle(Rectangle(x, y + 1 + yoffset, mGlyph[(int)(' ')].width - 1,
mGlyph[(int)(' ')].height - 2));
return mGlyph[(int)(' ')].width + mGlyphSpacing;
}
graphics->drawImage(mImage, mGlyph[glyph].x, mGlyph[glyph].y, x,
y + yoffset, mGlyph[glyph].width, mGlyph[glyph].height);
return mGlyph[glyph].width + mGlyphSpacing;
}
void ImageFont::drawString(Graphics* graphics, const std::string& text, int x, int y)
{
unsigned int i;
for (i = 0; i< text.size(); ++i)
{
drawGlyph(graphics, text.at(i), x, y);
x += getWidth(text.at(i));
}
x += getWidth(text.at(i));
}
}
void ImageFont::setRowSpacing(int spacing)
@ -228,12 +228,12 @@ namespace gcn
{
return mRowSpacing;
}
void ImageFont::setGlyphSpacing(int spacing)
{
mGlyphSpacing = spacing;
}
int ImageFont::getGlyphSpacing()
{
return mGlyphSpacing;
@ -243,7 +243,7 @@ namespace gcn
int &y, const Color& separator)
{
ImageLoader* il = Image::_getImageLoader();
Color color;
do
{
@ -266,14 +266,14 @@ namespace gcn
//throw GCN_EXCEPTION(os.str());
assert(0);
}
}
}
color = il->getPixel(x, y);
} while (color == separator);
int w = 0;
do
{
++w;
@ -289,45 +289,45 @@ namespace gcn
os << "'";
//throw GCN_EXCEPTION(os.str());
assert(0);
}
}
color = il->getPixel(x + w, y);
} while (color != separator);
mGlyph[c] = Rectangle(x, y, w, mHeight);
x += w;
x += w;
}
int ImageFont::getWidth(const std::string& text) const
{
unsigned int i;
int size = 0;
for (i = 0; i < text.size(); ++i)
{
size += getWidth(text.at(i));
}
return size;
return size;
}
int ImageFont::getStringIndexAt(const std::string& text, int x)
{
unsigned int i;
int size = 0;
for (i = 0; i < text.size(); ++i)
{
size += getWidth(text.at(i));
if (size > x)
{
return i;
}
}
return text.size();
return text.size();
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -76,7 +76,7 @@ namespace gcn
* Destructor.
*/
virtual ~ActionListener() { }
/**
* Called whan an action is recieved from a Widget. It is used
* to be able to recieve a notification that an action has

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -65,7 +65,7 @@ extern "C"
* Exists to be able to check for Guichan Allegro with autotools.
*
* @bug Autotools is incapable of finding this function.
*/
*/
extern void gcnAllegro();
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -99,7 +99,7 @@ namespace gcn
* NOTE: Size is not checked recursively all the way back to the
* top Widget. If the BasicContainer itself is clipped,
* the size may be inaccurate.
*
*
* @param width the width the Widget's draw space has.
* @param height the height the Widget's draw space has.
* @param widget the Widget calling the function.
@ -112,8 +112,8 @@ namespace gcn
* @param widget the destroyed Widget.
*/
virtual void _announceDeath(Widget *widget) = 0;
};
};
}
#endif // end GCN_BASICCONTAINER_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -67,7 +67,7 @@ namespace gcn
class GCN_CORE_DECLSPEC ClipRectangle : public Rectangle
{
public:
/**
* Constructor.
*/
@ -81,7 +81,7 @@ namespace gcn
* @param width the rectangle width.
* @param height the rectangle height.
* @param xOffset origin of drawing (used by Graphics).
* @param yOffset origin of drawing (used by Graphics) .
* @param yOffset origin of drawing (used by Graphics) .
*/
ClipRectangle(int x, int y, int width, int height, int xOffset, int yOffset);

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -60,23 +60,23 @@
namespace gcn
{
/**
* Represents a color with red, green, blue and alpha components.
* Represents a color with red, green, blue and alpha components.
*/
class GCN_CORE_DECLSPEC Color
{
{
public:
/**
* Constructor. Initializes the color to black.
*/
Color();
/**
* Constructs a color from the bytes in an integer. Call it with
* a hexadecimal constant for HTML-style color representation.
* The alpha component will be set to 255.
*
* EXAMPLE: Color(0xff50a0) constructs Gui-chan's favourite color.
* EXAMPLE: Color(0xff50a0) constructs Gui-chan's favourite color.
*
* NOTE: Because of this constructor, integers will be automatically casted
* to a color by your compiler.
@ -84,7 +84,7 @@ namespace gcn
* @param color the color.
*/
Color(int color);
/**
* Constructor.
*
@ -119,10 +119,10 @@ namespace gcn
* The values will be clamped if they go out of range.
*
* @param value the value to multiply the color with.
* @return the resulting color with alpha untouched.
* @return the resulting color with alpha untouched.
*/
Color operator*(float value) const;
/**
* Compares two colors.
*
@ -149,15 +149,15 @@ namespace gcn
/**
* Blue color component (range 0-255).
*/
*/
int b;
/**
* Color alpha, used for transparency. A value of 0 means totaly
* transparent, 255 is totaly opaque (the default)
*/
int a;
};
*/
int a;
};
}
#endif // end GCN_COLOR_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -72,7 +72,7 @@ namespace gcn
* Destructor.
*/
virtual ~DefaultFont(){}
/**
* Draws a glyph as a rectangle. The glyphs always be drawn as
* rectangles no matter the glyph.
@ -89,17 +89,17 @@ namespace gcn
*/
virtual int drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y);
// Inherited from Font
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y);
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y);
virtual int getWidth(const std::string& text) const;
virtual int getHeight() const;
virtual int getStringIndexAt(const std::string& text, int x);
};
virtual int getHeight() const;
virtual int getStringIndexAt(const std::string& text, int x);
};
}
#endif // end GCN_DEFAULTFONT_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -128,7 +128,7 @@ namespace gcn
* @return the function name in which the exception was thrown.
*/
const std::string& getFunction() const;
/**
* Gets the error message of the exception.
*
@ -144,12 +144,12 @@ namespace gcn
const std::string& getFilename() const;
/**
* Gets the line number of the line where the exception was thrown.
* Gets the line number of the line where the exception was thrown.
*
* @return the line number of the line where the exception was thrown.
*/
int getLine() const;
protected:
std::string mFunction;
std::string mMessage;
@ -163,5 +163,5 @@ namespace gcn
/*
* "Final Fantasy XI is the BEST!... It's even better then water!"
* - Astrolite
* I believe it's WoW now days.
* I believe it's WoW now days.
*/

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -63,7 +63,7 @@
namespace gcn
{
class Widget;
/**
* Used to keep track of widget focus. You will probably not have
* to use the FocusHandler directly to handle focus. Widget has
@ -80,7 +80,7 @@ namespace gcn
class GCN_CORE_DECLSPEC FocusHandler
{
public:
/**
* Constructor.
*/
@ -90,7 +90,7 @@ namespace gcn
* Destructor.
*/
virtual ~FocusHandler() { };
/**
* Sets focus to a Widget. Widget::lostFocus and
* Widget::gotFocus will be called.
@ -110,7 +110,7 @@ namespace gcn
* @param widget the Widget to drag.
*/
virtual void requestDrag(Widget* widget);
/**
* Sets modal focus to a Widget. If another Widget already
* has modal focus will an exception be thrown.
@ -127,15 +127,15 @@ namespace gcn
* @param widget the Widget to release modal focus for.
*/
virtual void releaseModalFocus(Widget* widget);
/**
* Gets the Widget with focus.
* Gets the Widget with focus.
*
* @return the Widget with focus. NULL will be returned if
* no Widget has focus.
*/
virtual Widget* getFocused() const;
/**
* Gets the widget that is dragged.
*
@ -151,18 +151,18 @@ namespace gcn
* if no Widget has modal focus.
*/
virtual Widget* getModalFocused() const;
/**
* Focuses the next Widget. If no Widget has focus the first
* Widget gets focus. The order in which the Widgets are focused
* depends on the order you add them to the GUI.
*/
virtual void focusNext();
/**
* Focuses the previous Widget. If no Widget has focus the first
* Widget gets focus. The order in which the widgets are focused
* depends on the order you add them to the GUI.
* depends on the order you add them to the GUI.
*/
virtual void focusPrevious();
@ -181,18 +181,18 @@ namespace gcn
* @return true if the widget is being dragged.
*/
virtual bool isDragged(const Widget* widget) const;
/**
* Adds a widget to the FocusHandler.
*
* @param widget the widget to add.
*/
virtual void add(Widget* widget);
/**
* Removes a widget from the FocusHandler.
*
* @param widget the widget to remove.
* @param widget the widget to remove.
*/
virtual void remove(Widget* widget);
@ -200,7 +200,7 @@ namespace gcn
* Focuses nothing.
*/
virtual void focusNone();
/**
* Focuses the next Widget which allows tab in unless current focused
* Widget disallows tab out.
@ -227,18 +227,18 @@ namespace gcn
* Check if a hot key was pressed.
*/
virtual void checkHotKey(const KeyInput &keyInput);
protected:
typedef std::vector<Widget*> WidgetVector;
typedef WidgetVector::iterator WidgetIterator;
WidgetVector mWidgets;
Widget* mFocusedWidget;
Widget* mDraggedWidget;
Widget* mToBeFocused;
Widget* mToBeDragged;
Widget* mModalFocusedWidget;
};
Widget* mModalFocusedWidget;
};
}
#endif // end GCN_FOCUSHANDLER_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -77,7 +77,7 @@ namespace gcn
/**
* Gets the width of a string. The width of a string is not necesserily
* the sum of all the widths of it's glyphs.
* the sum of all the widths of it's glyphs.
*
* @param text the string to return the width of.
* @return the width of a string.
@ -101,10 +101,10 @@ namespace gcn
* @return a string index in a string providing an x coordinate.
*/
virtual int getStringIndexAt(const std::string& text, int x);
/**
* Draws a string.
*
*
* NOTE: You normally won't use this function to draw text since
* Graphics contains better functions for drawing text.
*
@ -113,8 +113,8 @@ namespace gcn
* @param x the x coordinate where to draw the string.
* @param y the y coordinate where to draw the string.
*/
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y) = 0;
};
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y) = 0;
};
}
#endif // end GCN_FONT_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -66,7 +66,7 @@
namespace gcn
{
class Font;
/**
* Used for drawing graphics. It contains all vital functions for drawing.
* We include implemented Graphics classes for some common platforms like the
@ -82,23 +82,23 @@ namespace gcn
* by container widgets when their child widgets are drawn.
*
* IMPORTANT: Remember to pop each clip area that you pushed on the stack
* after you are done with it.
* after you are done with it.
*
* If you feel that Graphics is to restrictive for your needs, there is
* no one stopping you from using your own code for drawing in Widgets.
* You could for instance use pure SDL in the drawing of Widgets bypassing
* Graphics. This might however hurt portability of your application.
*
*
* If you implement a Graphics class not present in Guichan we would be very
* happy to add it to Guichan.
*
* @see AllegroGraphics, OpenGLGraphics, SDLGraphics, Image
*/
*/
class GCN_CORE_DECLSPEC Graphics
{
public:
Graphics();
virtual ~Graphics() { }
/**
@ -107,7 +107,7 @@ namespace gcn
* preparations before drawing. An example of such an implementation
* would be OpenGLGraphics.
*
* NOTE: You will never need to call this function yourself.
* NOTE: You will never need to call this function yourself.
* Gui will do it for you.
*
* @see _endDraw, Gui::draw
@ -124,7 +124,7 @@ namespace gcn
* @see _beginDraw, Gui::draw
*/
virtual void _endDraw() { }
/**
* Pushes a clip area onto the stack. The x and y coordinates in the
* Rectangle will be relative to the last pushed clip area.
@ -152,16 +152,16 @@ namespace gcn
* @return the current ClipArea.
*/
virtual const ClipRectangle& getCurrentClipArea();
/**
* Draws a part of an Image.
*
*
* NOTE: Width and height arguments will not scale the Image but
* specifies the size of the part to be drawn. If you want
* to draw the whole Image there is a simplified version of
* this function.
*
* EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endcode
* EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endcode
* Will draw a rectangular piece of myImage starting at coordinate
* (10, 10) in myImage, with width and height 40. The piece will be
* drawn with it's top left corner at coordinate (20, 20).
@ -184,7 +184,7 @@ namespace gcn
* @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), image->getHeight()); @endcode
*/
virtual void drawImage(const Image* image, int dstX, int dstY);
/**
* Draws a single point/pixel.
*
@ -202,7 +202,7 @@ namespace gcn
* @param y2 the second y coordinate.
*/
virtual void drawLine(int x1, int y1, int x2, int y2) = 0;
/**
* Draws a simple, non-filled, Rectangle with one pixel width.
*
@ -237,13 +237,13 @@ namespace gcn
* @param font the Font to use when drawing.
*/
virtual void setFont(Font* font);
/**
* Draws text.
*
* @param text the text to draw.
* @param x the x coordinate where to draw the text.
* @param y the y coordinate where to draw the text.
* @param y the y coordinate where to draw the text.
* @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT.
* @throws Exception when no Font is set.
*/
@ -258,11 +258,11 @@ namespace gcn
CENTER,
RIGHT
};
protected:
std::stack<ClipRectangle> mClipStack;
Font* mFont;
};
Font* mFont;
};
}
#endif // end GCN_GRAPHICS_HPP
@ -272,4 +272,4 @@ namespace gcn
* finalman - "skall jag skriva det?"
* yakslem - "ja, varfor inte?"
*/

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -67,7 +67,7 @@ extern "C"
{
/**
* Exists to be able to check for Guichan SDL with autotools.
*/
*/
GCN_EXTENSION_DECLSPEC extern void gcnSDL();
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -71,7 +71,7 @@ namespace gcn
* @n
* This documentation is, and will always be, work in progress. If you find any errors, typos or inconsistencies, or if you feel something needs to be explained in more detail - don't hesitate to tell us.
*/
/**
* Gui core class. Contains a special widget called the top widget.
* If you want to be able to have more then one Widget in your Gui,
@ -123,7 +123,7 @@ namespace gcn
* Graphics object has been set.
*/
virtual Graphics* getGraphics() const;
/**
* Sets the Input object to use for input handling.
*
@ -131,7 +131,7 @@ namespace gcn
* @see SDLInput, AllegroInput
*/
virtual void setInput(Input* input);
/**
* Gets the Input object being used for input handling.
*
@ -139,7 +139,7 @@ namespace gcn
* Input object has been set.
*/
virtual Input* getInput() const;
/**
* Performs the Gui logic. By calling this function all logic
* functions down in the Gui heirarchy will be called.
@ -162,7 +162,7 @@ namespace gcn
* Focus none of the Widgets in the Gui.
*/
virtual void focusNone();
/**
* Toggles the use of the tab key to focus Widgets.
* By default, tabbing is enabled.
@ -179,17 +179,17 @@ namespace gcn
virtual bool isTabbingEnabled();
virtual void setUseDirtyDrawing(bool useDirtyDrawing);
protected:
bool mTopHasMouse;
bool mTabbing;
Widget* mTop;
Graphics* mGraphics;
Input* mInput;
FocusHandler* mFocusHandler;
bool mUseDirtyDrawing;
};
};
}
#endif // end GCN_GUI_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -81,7 +81,7 @@ namespace gcn
* Constructor.
*
* @param data the data of the image.
* @param width the width of the image.
* @param width the width of the image.
* @param height the height of the image.
*/
Image(void* data, int width, int height);
@ -99,7 +99,7 @@ namespace gcn
* if it was loaded with it.
*/
virtual ~Image();
/**
* Gets the width of the Image.
*
@ -119,7 +119,7 @@ namespace gcn
* depending on what ImageLoader you use. If you for instance use the
* SDLImageLoader then an SDL_Surface will be returned.
*
* @return a void pointer to the Image data.
* @return a void pointer to the Image data.
* @see SDLImageLoader, AllegroImageLoader
*/
virtual void* _getData() const;
@ -131,7 +131,7 @@ namespace gcn
* @see SDLImageLoader, AllegroImageLoader
*/
static ImageLoader* _getImageLoader();
/**
* Sets the ImageLoader to be used for loading images.
*
@ -142,19 +142,19 @@ namespace gcn
* @see SDLImageLoader, AllegroImageLoader
*/
static void setImageLoader(ImageLoader* imageLoader);
protected:
/**
* Default constructor. It is protected so you can inherit
* from this class.
*/
Image();
Image();
void* mData;
int mWidth;
int mHeight;
bool mLoadedWithImageLoader;
static ImageLoader* mImageLoader;
};
static ImageLoader* mImageLoader;
};
}
#endif // end GCN_IMAGE_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -67,7 +67,7 @@ namespace gcn
{
/**
* A font using an image containing the font data. It implements the font
* class. You can use any filetype for the font data as long as it can be
* class. You can use any filetype for the font data as long as it can be
* loaded with your ImageLoader.
*
* This are two examples of an image containing a font.
@ -97,7 +97,7 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
* Constructor which takes an image file containing the font and
* a string containing the glyphs. The glyphs in the string should
* be in the same order as they appear in the font image.
*
*
* @param filename the filename of the image.
* @param glyphs the glyphs found in the image.
* @throws Exception when glyph list is incorrect or the font file is
@ -115,17 +115,17 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
* @param glyphsFrom the ASCII value of the first glyph found in the
* image.
* @param glyphsTo the ASCII value of the last glyph found in the
* image.
* image.
* @throws Exception when glyph bondaries are incorrect or the font
* file is corrupt or if no ImageLoader exists.
*/
ImageFont(const std::string& filename, unsigned char glyphsFrom=32, unsigned char glyphsTo=126);
/**
* Destructor.
*/
virtual ~ImageFont();
/**
* Draws a glyph.
*
@ -171,26 +171,26 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
* @return the spacing.
*/
virtual int getGlyphSpacing();
/**
* Gets a width of a glyph.
*
* @param glyph the glyph which width will be returned
* @return the width of a glyph
* @return the width of a glyph
*/
virtual int getWidth(unsigned char glyph) const;
// Inherited from Font
virtual int getWidth(const std::string& text) const;
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y);
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y);
virtual int getHeight() const;
virtual int getStringIndexAt(const std::string& text, int x);
protected:
void addGlyph(unsigned char c, int &x, int &y, const Color& separator);
@ -199,8 +199,8 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
int mGlyphSpacing;
int mRowSpacing;
Image* mImage;
std::string mFilename;
};
std::string mFilename;
};
}
#endif // end GCN_IMAGEFONT_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -63,7 +63,7 @@
namespace gcn
{
class Image;
/**
* ImageLoaders base class. Contains basic image loading functions every
* image loader should have. Image loaders should inherit from this
@ -72,7 +72,7 @@ namespace gcn
class GCN_CORE_DECLSPEC ImageLoader
{
public:
/**
* Destructor.
*/
@ -107,7 +107,7 @@ namespace gcn
* @return a pointer to the raw image data.
*/
virtual void* getRawData() = 0;
/**
* Finalizes an image meaning it will return the image data. If the
* image contains pixels with "magic pink" (0xff00ff) they will be
@ -124,7 +124,7 @@ namespace gcn
* @throws Exception when no image has been prepared.
*/
virtual void discard() = 0;
/**
* Gets the height if the image.
*
@ -157,8 +157,8 @@ namespace gcn
* @param y the y coordinate.
* @param color the color of the pixel to put.
*/
virtual void putPixel(int x, int y, const Color& color) = 0;
};
virtual void putPixel(int x, int y, const Color& color) = 0;
};
}
#endif // end GCN_IMAGELOADER_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -98,10 +98,10 @@ namespace gcn
* @return true if the mouse queue is empty.
*/
virtual bool isMouseQueueEmpty() = 0;
/**
* Dequeues the mouse input queue.
*
*
* @return a MouseInput object.
* @see MouseInput
*/
@ -111,8 +111,8 @@ namespace gcn
* Polls all exsisting input. It exists for Input implementation
* compatibility. It is used internally by the library.
*/
virtual void _pollInput() = 0;
};
virtual void _pollInput() = 0;
};
}
#endif // end GCN_INPUT_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -96,7 +96,7 @@ namespace gcn
/**
* Checks whether a key is a letter.
*
* @return true if the key is a letter (a-z,A-Z).
* @return true if the key is a letter (a-z,A-Z).
*/
bool isLetter() const;
@ -117,7 +117,7 @@ namespace gcn
/**
* Checks whether control is pressed.
* @return true if control was pressed at the same time as the key.
*/
*/
bool isControlPressed() const;
/**
@ -248,7 +248,7 @@ namespace gcn
bool mControlPressed;
bool mAltPressed;
bool mMetaPressed;
bool mNumericPad;
bool mNumericPad;
};
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -80,7 +80,7 @@ namespace gcn
* @param type the type of input.
*/
KeyInput(const Key& key, int type);
/**
* Sets the input type.
*
@ -119,7 +119,7 @@ namespace gcn
PRESS,
RELEASE
};
protected:
Key mKey;
int mType;

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -79,7 +79,7 @@ namespace gcn
* Destructor
*/
virtual ~KeyListener() { }
/**
* Called if a key is pressed when the widget has keyboard focus.
* If a key is held down the widget will generate multiple key
@ -107,7 +107,7 @@ namespace gcn
* therefore its constructor is protected. To use KeyListener
* you must inherit from this class and implement it's
* functions.
*/
*/
KeyListener() { }
};
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -118,7 +118,7 @@ namespace gcn
* @param timeStamp the timestamp of the input.
*/
void setTimeStamp(int timeStamp);
/**
* Gets the time stamp of the input.
*
@ -141,13 +141,13 @@ namespace gcn
RELEASE,
MOTION
};
int x, y;
protected:
int mType;
int mButton;
int mTimeStamp;
int mTimeStamp;
};
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -65,7 +65,7 @@ namespace gcn
* Mouse listeners base class. Inorder to use this class you must inherit
* from it and implements it's functions. MouseListeners listen for mouse
* events on a Widgets. When a Widget recives a mouse event, the
* corresponding function in all it's mouse listeners will be
* corresponding function in all it's mouse listeners will be
*
* @see Widget::addMouseListener
*/
@ -109,7 +109,7 @@ namespace gcn
*
* @param x the x coordinate of the mouse relative to the Widget
* itself.
*
*
* @param y the y coordinate of the mouse relative to the Widget
* itself.
* @param button the button released.
@ -121,7 +121,7 @@ namespace gcn
* Called when a mouse button is pressed and released (clicked)
* when the mouse is in the Widget area or if the Widget has
* focus.
*
*
* @param x the x coordinate of the mouse relative to the Widget
* itself.
* @param y the y coordinate of the mouse relative to the Widget
@ -130,11 +130,11 @@ namespace gcn
* @param count the number of clicks.
*/
virtual void mouseClick(int, int, int, int) { }
/**
* Called on a mouse wheel up when the mouse is in the Widget
* area or if the Widget has focus.
*
*
* @param x the x coordinate of the mouse relative to the Widget
* itself.
* @param y the y coordinate of the mouse relative to the Widget
@ -145,7 +145,7 @@ namespace gcn
/**
* Called on a mouse wheel down when the mouse is in the Widget
* area or if the Widget has focus.
*
*
* @param x the x coordinate of the mouse relative to the Widget
* itself.
* @param y the y coordinate of the mouse relative to the Widget
@ -156,7 +156,7 @@ namespace gcn
/**
* Called when the mouse moves and the mouse is in the Widget
* area or if the Widget has focus.
*
*
* @param x the x coordinate of the mouse relative to the Widget
* itself.
* @param y the y coordinate of the mouse relative to the Widget
@ -172,7 +172,7 @@ namespace gcn
* therefore its constructor is protected. To use MouseListener
* you must inherit from this class and implement it's
* functions.
*/
*/
MouseListener() { }
};
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -80,7 +80,7 @@ namespace gcn
* @param height the Rectangle height.
*/
Rectangle(int x, int y, int width, int height);
/**
* Sets the dimension of a rectangle.
*
@ -100,9 +100,9 @@ namespace gcn
bool intersect(const Rectangle& rectangle) const
{
return !(rectangle.x > x + width ||
rectangle.y > y + height ||
x > rectangle.x + rectangle.width ||
y > rectangle.y + rectangle.height);
rectangle.y > y + height ||
x > rectangle.x + rectangle.width ||
y > rectangle.y + rectangle.height);
}
/**
@ -112,12 +112,12 @@ namespace gcn
* @param y the point y coordinate
*/
bool isPointInRect(int x, int y) const;
int x;
int y;
int width;
int height;
};
int height;
};
}
#endif // end GCN_RECTANGEL_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -73,15 +73,15 @@ namespace gcn
class GCN_EXTENSION_DECLSPEC SDLGraphics : public Graphics
{
public:
// Needed so that drawImage(gcn::Image *, int, int) is visible.
using Graphics::drawImage;
/**
* Constructor.
*/
SDLGraphics();
/**
* Sets the target SDL_Surface to draw to. The target can be any
* SDL_Surface. This funtion also pushes a clip areas corresponding to
@ -108,25 +108,25 @@ namespace gcn
virtual void drawSDLSurface(SDL_Surface* surface, SDL_Rect source,
SDL_Rect destination);
// Inherited from Graphics
virtual void _beginDraw();
virtual void _endDraw();
virtual bool pushClipArea(Rectangle area);
virtual void popClipArea();
virtual void drawImage(const Image* image, int srcX, int srcY,
int dstX, int dstY, int width,
int height);
int height);
virtual void drawPoint(int x, int y);
virtual void drawLine(int x1, int y1, int x2, int y2);
virtual void drawRectangle(const Rectangle& rectangle);
virtual void fillRectangle(const Rectangle& rectangle);
@ -134,7 +134,7 @@ namespace gcn
virtual void setColor(const Color& color);
virtual const Color& getColor();
protected:
/**
* Draws a horizontal line.
@ -156,8 +156,8 @@ namespace gcn
SDL_Surface* mTarget;
Color mColor;
bool mAlpha;
};
bool mAlpha;
};
}
#endif // end GCN_SDLGRAPHICS_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -79,28 +79,28 @@ namespace gcn
// Inherited from ImageLoader
virtual void prepare(const std::string& filename);
virtual void free(Image* image);
virtual void* getRawData();
virtual void* finalize();
virtual void discard();
virtual int getHeight() const;
virtual int getWidth() const;
virtual Color getPixel(int x, int y);
virtual void putPixel(int x, int y, const Color& color);
protected:
SDL_Surface* mCurrentImage;
};
SDL_Surface* mCurrentImage;
};
}
#endif // end GCN_SDLIMAGELOADER_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -86,7 +86,7 @@ namespace gcn
* @param event an event from SDL.
*/
virtual void pushInput(SDL_Event event);
/**
* Polls all input. It exists for input driver compatibility. If you
* only use SDL and plan sticking with SDL you can safely ignore this
@ -96,7 +96,7 @@ namespace gcn
// Inherited from Input
virtual bool isKeyQueueEmpty();
virtual KeyInput dequeueKeyInput();
@ -121,7 +121,7 @@ namespace gcn
* representation.
*
* @param button an SDL mouse button.
* @return a Guichan button.
* @return a Guichan button.
*/
int convertMouseButton(int button);
@ -132,7 +132,7 @@ namespace gcn
bool mMouseInWindow;
Key mLastKey;
bool mIsRepeating;
};
};
}
#endif // end GCN_SDLINPUT_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -77,19 +77,19 @@ namespace gcn
SDL_LockSurface(surface);
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
unsigned int color = 0;
switch(bpp)
{
case 1:
color = *p;
break;
case 2:
color = *(Uint16 *)p;
break;
case 3:
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
@ -100,15 +100,15 @@ namespace gcn
color = p[0] | p[1] << 8 | p[2] << 16;
}
break;
case 4:
color = *(Uint32 *)p;
break;
}
Uint8 r,g,b,a;
SDL_GetRGBA(color, surface->format, &r, &g, &b, &a);
SDL_UnlockSurface(surface);
@ -126,11 +126,11 @@ namespace gcn
inline void SDLputPixel(SDL_Surface* surface, int x, int y, const Color& color)
{
int bpp = surface->format->BytesPerPixel;
SDL_LockSurface(surface);
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b);
switch(bpp)
@ -138,11 +138,11 @@ namespace gcn
case 1:
*p = pixel;
break;
case 2:
*(Uint16 *)p = pixel;
break;
case 3:
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
@ -157,12 +157,12 @@ namespace gcn
p[2] = (pixel >> 16) & 0xff;
}
break;
case 4:
*(Uint32 *)p = pixel;
break;
}
SDL_UnlockSurface(surface);
}
@ -183,7 +183,7 @@ namespace gcn
dst = ((((dst - src) * a) >> 5) + src) & 0x07E0F81F;
return (dst >> 16) | dst;
}
/**
* Blends two 32 bit colors together.
*
@ -205,7 +205,7 @@ namespace gcn
dst2 = ((((dst2 - src2) * a) >> 8) + src2) & 0x00FF00FF;
return dst | (dst2 << 8);
}
/**
* Puts a pixel on an SDL_Surface with alpha
*
@ -217,11 +217,11 @@ namespace gcn
inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, const Color& color)
{
int bpp = surface->format->BytesPerPixel;
SDL_LockSurface(surface);
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b);
switch(bpp)
@ -229,11 +229,11 @@ namespace gcn
case 1:
*p = pixel;
break;
case 2:
*(Uint16 *)p = SDLAlpha16(pixel, *(Uint16 *)p, color.a);
break;
case 3:
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
@ -248,12 +248,12 @@ namespace gcn
p[2] = (pixel >> 16) & 0xff;
}
break;
case 4:
*(Uint32 *)p = SDLAlpha32(pixel, *(Uint32 *)p, color.a);
break;
}
SDL_UnlockSurface(surface);
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -99,7 +99,7 @@ namespace gcn
* focusable should overide this default in their own constructor.
*/
Widget();
/**
* Default destructor.
*/
@ -115,17 +115,17 @@ namespace gcn
* @param graphics a Graphics object to draw with.
*/
virtual void draw(Graphics* graphics) = 0;
/**
* Draws a the Widget border. A border is drawn around a Widget.
* The width and height of the border is therefore the Widgets
* height+2*bordersize. Think of a painting that has a certain size,
* the border surrounds the painting.
* the border surrounds the painting.
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawBorder(Graphics*) { }
/**
* Called for all Widgets in the gui each time Gui::logic is called.
* You can do logic stuff here like playing an animation.
@ -133,15 +133,15 @@ namespace gcn
* @see Gui
*/
virtual void logic() { }
/**
* Gets the Widget parent container.
*
* @return the Widget parent container. Returns NULL if the Widget
* has no parent.
* has no parent.
*/
virtual BasicContainer* getParent() const;
/**
* Sets the width of the Widget in pixels.
*
@ -155,7 +155,7 @@ namespace gcn
* @return the Widget with in pixels.
*/
virtual int getWidth() const;
/**
* Sets the height of the Widget in pixels.
*
@ -177,7 +177,7 @@ namespace gcn
* @param height the height.
*/
virtual void setSize(int width, int height);
/**
* Set the Widget x coordinate. It is relateive to it's parent.
*
@ -195,7 +195,7 @@ namespace gcn
/**
* Set the Widget y coordinate. It is relative to it's parent.
*
* @param y the Widget y coordinate.
* @param y the Widget y coordinate.
*/
virtual void setY(int y);
@ -213,7 +213,7 @@ namespace gcn
* @param y the Widgets y coordinate.
*/
virtual void setPosition(int x, int y);
/**
* Sets the dimension of the Widget. It is relative to it's parent.
*
@ -224,23 +224,23 @@ namespace gcn
/**
* Sets the size of the border, or the width if you so like. The size
* is the number of pixels that the border extends outside the Widget.
* Border size = 0 means no border.
* Border size = 0 means no border.
*
* @param borderSize the size of the border.
* @see drawBorder
* @see drawBorder
*/
virtual void setBorderSize(unsigned int borderSize);
/**
* Gets the size of the border, or the width if you so like. The size
* is the number of pixels that the border extends outside the Widget.
* Border size = 0 means no border.
* Border size = 0 means no border.
*
* @return the size of the border.
* @see drawBorder
* @see drawBorder
*/
virtual unsigned int getBorderSize() const;
/**
* Gets the dimension of the Widget. It is relative to it's parent.
*
@ -261,7 +261,7 @@ namespace gcn
* @return true if the widget is focusable.
*/
virtual bool isFocusable() const;
/**
* Checks if the Widget has focus.
*
@ -282,25 +282,25 @@ namespace gcn
*
* @return true if the Widget should be enabled.
*/
virtual bool isEnabled() const;
virtual bool isEnabled() const;
/**
* Called if the Widget loses focus.
*/
virtual void lostFocus() { setDirty(true); };
/**
* Called if the Widget recieves focus.
* Called if the Widget recieves focus.
*/
virtual void gotFocus() { setDirty(true); };
/**
* Checks if the Widget has the mouse.
*
* @return true if the Widget has the mouse.
*/
virtual bool hasMouse() const;
/**
* Sets the Widget to be visible.
*
@ -329,7 +329,7 @@ namespace gcn
* @return the foreground Color.
*/
virtual const Color& getBaseColor() const;
/**
* Sets the foreground color.
*
@ -343,7 +343,7 @@ namespace gcn
* @return the foreground Color.
*/
virtual const Color& getForegroundColor() const;
/**
* Sets the background color.
*
@ -356,7 +356,7 @@ namespace gcn
*
* @return the background Color.
*/
virtual const Color& getBackgroundColor() const;
virtual const Color& getBackgroundColor() const;
/**
* Sets the disabled color.
@ -370,7 +370,7 @@ namespace gcn
*
* @return the disabled Color.
*/
virtual const Color& getDisabledColor() const;
virtual const Color& getDisabledColor() const;
/**
* Called when a Widget recieves a MouseInput.
@ -421,7 +421,7 @@ namespace gcn
* unless you know what you are doing.
*/
virtual void _mouseOutMessage();
/**
* Requests focus for the Widget. A Widget will only recieve focus
* if it is focusable.
@ -468,7 +468,7 @@ namespace gcn
* @param actionListener the ActionListener to add.
*/
virtual void addActionListener(ActionListener* actionListener);
/**
* Removes an added ActionListener from the Widget.
*
@ -483,12 +483,12 @@ namespace gcn
* @param mouseListener the MouseListener to add.
*/
virtual void addMouseListener(MouseListener* mouseListener);
/**
* Removes an added MouseListener from the Widget.
*
* @param mouseListener the MouseListener to remove.
*/
*/
virtual void removeMouseListener(MouseListener* mouseListener);
/**
@ -496,14 +496,14 @@ namespace gcn
* it will be sent to the Widget's KeyListeners.
*
* @param keyListener the KeyListener to add.
*/
*/
virtual void addKeyListener(KeyListener* keyListener);
/**
* Removes an added KeyListener from the Widget.
*
* @param keyListener the KeyListener to remove.
*/
*/
virtual void removeKeyListener(KeyListener* keyListener);
/**
@ -514,9 +514,9 @@ namespace gcn
* NOTE: An event identifier should not be used to identify a certain
* Widget but rather a certain event in your application. Several
* Widgets can have the same event identifer.
*
*
* @param eventId the event identifier.
*/
*/
virtual void setEventId(const std::string& eventId);
/**
@ -531,9 +531,9 @@ namespace gcn
*
* @param x absolute x coordinate will be stored in this parameter.
* @param y absolute y coordinate will be stored in this parameter.
*/
*/
virtual void getAbsolutePosition(int& x, int& y) const;
/**
* Sets the parent of the Widget. A parent must be a BasicContainer.
*
@ -541,8 +541,8 @@ namespace gcn
* be called or overloaded unless you know what you
* are doing.
*
* @param parent the parent BasicContainer..
*/
* @param parent the parent BasicContainer..
*/
virtual void _setParent(BasicContainer* parent);
/**
@ -554,14 +554,14 @@ namespace gcn
* @return the used Font.
*/
Font *getFont() const;
/**
* Sets the global font to be used by default for all Widgets.
*
* @param font the global Font.
*/
static void setGlobalFont(Font* font);
/**
* Sets the font. If font is NULL, the global font will be used.
*
@ -604,7 +604,7 @@ namespace gcn
* @return true if tab in is enabled.
*/
virtual bool isTabInEnabled() const;
/**
* Sets tab in enabled. Tab in means that you can set focus
* to this Widget by pressing the tab button. If tab in is disabled
@ -624,7 +624,7 @@ namespace gcn
* @return true if tab out is enabled.
*/
virtual bool isTabOutEnabled() const;
/**
* Sets tab out enabled. Tab out means that you can lose
* focus to this Widget by pressing the tab button. If tab out is
@ -658,7 +658,7 @@ namespace gcn
* Widget has the modal focus.
*/
virtual void releaseModalFocus();
/**
* Checks if the Widget or it's parent has modal focus.
*/
@ -667,25 +667,25 @@ namespace gcn
virtual void setDirty(bool dirty);
virtual bool getDirty() const;
protected:
/**
* Generates an action to the Widget's ActionListeners.
*/
void generateAction();
typedef std::list<MouseListener*> MouseListenerList;
MouseListenerList mMouseListeners;
typedef MouseListenerList::iterator MouseListenerIterator;
typedef std::list<KeyListener*> KeyListenerList;
KeyListenerList mKeyListeners;
typedef KeyListenerList::iterator KeyListenerIterator;
typedef std::list<ActionListener*> ActionListenerList;
ActionListenerList mActionListeners;
typedef ActionListenerList::iterator ActionListenerIterator;
Color mForegroundColor;
Color mBackgroundColor;
Color mBaseColor;
@ -704,14 +704,14 @@ namespace gcn
bool mTabIn;
bool mTabOut;
bool mEnabled;
Font* mCurrentFont;
int mHotKey;
static DefaultFont mDefaultFont;
static Font* mGlobalFont;
static std::list<Widget*> mWidgets;
bool mDirty;
};
};
}
#endif // end GCN_WIDGET_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -86,14 +86,14 @@ namespace gcn
* @param caption the caption of the Button.
*/
Button(const std::string& caption);
/**
* Sets the Button caption.
*
* @param caption the Button caption.
*/
virtual void setCaption(const std::string& caption);
/**
* Gets the Button caption.
*
@ -115,9 +115,9 @@ namespace gcn
* @return alignment of caption.
*/
virtual unsigned int getAlignment() const;
/**
* Adjusts the buttons size to fit the content.
* Adjusts the buttons size to fit the content.
*/
virtual void adjustSize();
@ -128,20 +128,20 @@ namespace gcn
*/
virtual bool isPressed() const;
//Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void lostFocus();
virtual void hotKeyPress();
virtual void hotKeyRelease();
// Inherited from MouseListener
virtual void mouseClick(int x, int y, int button, int count);
virtual void mousePress(int x, int y, int button);
@ -152,14 +152,14 @@ namespace gcn
// Inherited from KeyListener
virtual bool keyPress(const Key& key);
virtual bool keyRelease(const Key& key);
protected:
std::string mCaption;
bool mMouseDown, mKeyDown, mHotKeyDown;
unsigned int mAlignment;
};
unsigned int mAlignment;
};
}
#endif // end GCN_BUTTON_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -91,7 +91,7 @@ namespace gcn
* Destructor.
*/
virtual ~CheckBox() { }
/**
* Draws the box i.a not the caption.
*
@ -103,42 +103,42 @@ namespace gcn
* Checks if the CheckBox is marked.
*
* @return true if the CheckBox is marked.
*/
*/
virtual bool isMarked() const;
/**
* Sets the CheckBox to be marked.
*
* @param marked true if the CheckBox should be marked.
*/
virtual void setMarked(bool marked);
/**
* Gets the CheckBox caption.
*
* @return the CheckBox caption.
*/
virtual const std::string &getCaption() const;
/**
* Sets the CheckBox caption.
*
* @param caption the CheckBox caption.
*/
virtual void setCaption(const std::string &caption);
/**
* Adjusts the CheckBox size to fit the font size.
*/
virtual void adjustSize();
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from KeyListener
@ -155,10 +155,10 @@ namespace gcn
* Toggles between marked and unmarked.
*/
virtual void toggle();
bool mMarked;
std::string mCaption;
};
std::string mCaption;
};
}
#endif // end GCN_CHECKBOX_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -123,7 +123,7 @@ namespace gcn
* @see remove
*/
virtual void add(Widget* widget, int x, int y);
/**
* Removes a Widget from the Container.
*
@ -143,13 +143,13 @@ namespace gcn
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic();
virtual void _setFocusHandler(FocusHandler* focusHandler);
virtual void _mouseInputMessage(const MouseInput &mouseInput);
@ -179,21 +179,21 @@ namespace gcn
* @param graphics the Graphics object to draw with.
*/
virtual void drawChildren(Graphics* graphics);
/**
* Calls the logic function for all children of Container. The Widgets
* logic function will be called in the order the Widgets were added
* to the Container.
* to the Container.
*/
virtual void logicChildren();
Widget* mWidgetWithMouse;
typedef std::list<Widget*> WidgetList;
typedef WidgetList::iterator WidgetIterator;
typedef WidgetList::const_iterator WidgetConstIterator;
WidgetList mWidgets;
bool mOpaque;
};
bool mOpaque;
};
}
#endif // end GCN_CONTAINER_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -92,9 +92,9 @@ namespace gcn
*
* @param listModel the ListModel to use.
* @see ListModel.
*/
*/
DropDown(ListModel *listModel);
/**
* Contructor.
*
@ -102,7 +102,7 @@ namespace gcn
* @param scrollArea the ScrollArea to use.
* @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox.
*/
*/
DropDown(ListModel *listModel,
ScrollArea *scrollArea,
ListBox *listBox);
@ -111,7 +111,7 @@ namespace gcn
* Destructor.
*/
virtual ~DropDown();
/**
* Gets the index int the ListModel of the selected element.
*
@ -175,15 +175,15 @@ namespace gcn
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual bool _keyInputMessage(const KeyInput& keyInput);
virtual void logic();
virtual void _mouseInputMessage(const MouseInput &mouseInput);
virtual void lostFocus();
@ -194,7 +194,7 @@ namespace gcn
virtual void setForegroundColor(const Color& color);
// Inherited from BasicContainer
virtual void moveToTop(Widget* widget);
@ -207,20 +207,20 @@ namespace gcn
// Inherited from ActionListener
virtual void action(const std::string& eventId);
// Inherited from KeyListener
virtual bool keyPress(const Key& key);
// Inherited from MouseListener
virtual void mousePress(int x, int y, int button);
virtual void mouseRelease(int x, int y, int button);
virtual void mouseRelease(int x, int y, int button);
virtual void setFont(Font *font);
@ -243,7 +243,7 @@ namespace gcn
* Sets the DropDown Widget to folded-up mode.
*/
virtual void foldUp();
bool mDroppedDown;
bool mPushed;
int mOldH;
@ -251,8 +251,8 @@ namespace gcn
ListBox* mListBox;
ScrollArea* mDefaultScrollArea;
ListBox* mDefaultListBox;
FocusHandler mFocusHandler;
};
FocusHandler mFocusHandler;
};
}
#endif // end GCN_DROPDOWN_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -63,7 +63,7 @@ namespace gcn
{
/**
* An Icon for displaying images.
*/
*/
class GCN_CORE_DECLSPEC Icon: public Widget
{
public:
@ -73,17 +73,17 @@ namespace gcn
* @param image an Image to display.
*/
Icon(Image* image);
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
private:
Image* mImage;
};
Image* mImage;
};
}
#endif // end GCN_ICON_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -113,18 +113,18 @@ namespace gcn
* Adjusts the Label size to fit the font size.
*/
virtual void adjustSize();
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
private:
std::string mCaption;
unsigned int mAlignment;
};
unsigned int mAlignment;
};
}
#endif // end GCN_LABEL_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -64,7 +64,7 @@
namespace gcn
{
/**
* A ListBox displaying a list in which elemets can be selected. Only one
* A ListBox displaying a list in which elemets can be selected. Only one
* element can be selected at time. ListBox uses a ListModel to handle the
* list. To be able to use ListBox you must give ListBox an implemented
* ListModel which represents your list.
@ -91,14 +91,14 @@ namespace gcn
* Destructor.
*/
virtual ~ListBox() { }
/**
* Gets the ListModel index of the selected element.
*
* @return the ListModel index of the selected element.
*/
virtual int getSelected();
/**
* Sets the ListModel index of the selected element.
*
@ -131,7 +131,7 @@ namespace gcn
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic();
@ -146,8 +146,8 @@ namespace gcn
protected:
ListModel *mListModel;
int mSelected;
};
int mSelected;
};
}
#endif // end GCN_LISTBOX_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -89,14 +89,14 @@ namespace gcn
* @param marked true if the RadioButton should be marked.
*/
RadioButton(const std::string &caption,
const std::string &group,
const std::string &group,
bool marked=false);
/**
* Destructor.
*/
virtual ~RadioButton();
/**
* Draws the box i.a not the caption.
*
@ -108,9 +108,9 @@ namespace gcn
* Checks if the RadioButton is marked.
*
* @return true if the RadioButton is marked.
*/
*/
virtual bool isMarked() const;
/**
* Sets the RadioButton to be marked.
*
@ -157,7 +157,7 @@ namespace gcn
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from KeyListener
@ -167,17 +167,17 @@ namespace gcn
// Inherited from MouseListener
virtual void mouseClick(int x, int y, int button, int count);
protected:
protected:
bool mMarked;
std::string mCaption;
std::string mGroup;
typedef std::multimap<std::string, RadioButton *> GroupMap;
typedef GroupMap::iterator GroupIterator;
static GroupMap mGroupMap;
};
static GroupMap mGroupMap;
};
}
#endif // end GCN_RADIOBUTTON_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -87,7 +87,7 @@ namespace gcn
* Constructor.
*
* @param content the content of the ScrollArea.
*/
*/
ScrollArea(Widget *content);
/**
@ -98,26 +98,26 @@ namespace gcn
* policies.
* @param vPolicy the policy for the vertical scrollbar. See enum with
* policies.
*/
*/
ScrollArea(Widget *content, unsigned int hPolicy, unsigned int vPolicy);
/**
* Destructor.
*/
*/
virtual ~ScrollArea();
/**
* Sets the content.
*
* @param widget the content of the ScrollArea.
*/
*/
virtual void setContent(Widget* widget);
/**
* Gets the content.
*
* @return the content of the ScrollArea.
*/
*/
virtual Widget* getContent();
/**
@ -125,7 +125,7 @@ namespace gcn
*
* @param hPolicy the policy for the horizontal scrollbar. See enum with
* policies.
*/
*/
virtual void setHorizontalScrollPolicy(unsigned int hPolicy);
/**
@ -133,7 +133,7 @@ namespace gcn
*
* @return the policy for the horizontal scrollbar policy. See enum with
* policies.
*/
*/
virtual unsigned int getHorizontalScrollPolicy();
/**
@ -141,7 +141,7 @@ namespace gcn
*
* @param vPolicy the policy for the vertical scrollbar. See enum with
* policies.
*/
*/
virtual void setVerticalScrollPolicy(unsigned int vPolicy);
/**
@ -149,7 +149,7 @@ namespace gcn
*
* @return the policy for the vertical scrollbar. See enum with
* policies.
*/
*/
virtual unsigned int getVerticalScrollPolicy();
/**
@ -159,34 +159,34 @@ namespace gcn
* policies.
* @param vPolicy the policy for the vertical scrollbar. See enum with
* policies.
*/
*/
virtual void setScrollPolicy(unsigned int hPolicy, unsigned int vPolicy);
/**
* Sets the amount to scroll verticaly.
*
* @param vScroll the amount to scroll.
*/
*/
virtual void setVerticalScrollAmount(int vScroll);
/**
* Gets the amount that is scrolled verticaly.
* @return the scroll amount on vertical scroll.
*/
*/
virtual int getVerticalScrollAmount();
/**
* Sets the amount to scroll horizontaly.
*
* @param hScroll the amount to scroll.
*/
*/
virtual void setHorizontalScrollAmount(int hScroll);
/**
* Gets the amount that is scrolled horizontaly.
*
* @return the scroll amount on horizontal scroll.
*/
*/
virtual int getHorizontalScrollAmount();
/**
@ -194,21 +194,21 @@ namespace gcn
*
* @param hScroll the amount to scroll on horizontal scroll.
* @param vScroll the amount to scroll on vertical scroll.
*/
*/
virtual void setScrollAmount(int hScroll, int vScroll);
/**
* Gets the maximum amount of horizontal scroll.
*
* @return the horizontal max scroll.
*/
*/
virtual int getHorizontalMaxScroll();
/**
* Gets the maximum amount of vertical scroll.
*
* @return the vertical max scroll.
*/
*/
virtual int getVerticalMaxScroll();
/**
@ -220,7 +220,7 @@ namespace gcn
/**
* Gets the width.
* @return the width of the ScrollBar.
*/
virtual int getScrollbarWidth();
@ -236,17 +236,17 @@ namespace gcn
// Inherited from Widget
virtual void draw(Graphics *graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic();
virtual void _mouseInputMessage(const MouseInput &mouseInput);
virtual void _mouseOutMessage();
virtual void _setFocusHandler(FocusHandler* focusHandler);
@ -255,23 +255,23 @@ namespace gcn
virtual void _announceDeath(Widget *widget);
virtual void getDrawSize(int& width, int& height, Widget* widget);
virtual void moveToBottom(Widget* widget);
virtual void moveToTop(Widget* widget);
virtual void moveToTop(Widget* widget);
// Inherited from MouseListener
virtual void mousePress(int x, int y, int button);
virtual void mouseRelease(int x, int y, int button);
virtual void mouseMotion(int x, int y);
virtual void mouseWheelUp(int x, int y);
virtual void mouseWheelDown(int x, int y);
virtual void mouseWheelDown(int x, int y);
/**
@ -283,13 +283,13 @@ namespace gcn
* SHOW_AUTO - Show the scrollbars only when needed. That is if the
* content grows larger then the ScrollArea.
*/
enum
enum
{
SHOW_ALWAYS,
SHOW_NEVER,
SHOW_AUTO
};
protected:
/**
* Draws the up button.
@ -297,7 +297,7 @@ namespace gcn
* @param graphics a Graphics object to draw with.
*/
virtual void drawUpButton(Graphics *graphics);
/**
* Draws the down button.
*
@ -311,7 +311,7 @@ namespace gcn
* @param graphics a Graphics object to draw with.
*/
virtual void drawLeftButton(Graphics *graphics);
/**
* Draws the right button.
*
@ -328,28 +328,28 @@ namespace gcn
/**
* Draws the vertical scrollbar.
*
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawVBar(Graphics* graphics);
/**
* Draws the horizontal scrollbar.
*
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawHBar(Graphics* graphics);
/**
* Draws the vertical marker.
*
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawVMarker(Graphics* graphics);
/**
* Draws the horizontal marker.
*
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawHMarker(Graphics* graphics);
@ -414,14 +414,14 @@ namespace gcn
* @return the dimension of the vertical marker.
*/
virtual Rectangle getVerticalMarkerDimension();
/**
* Gets the horizontal marker dimension.
*
* @return the dimension of the horizontal marker.
*/
virtual Rectangle getHorizontalMarkerDimension();
Widget *mContent;
int mVScroll;
int mHScroll;

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -59,7 +59,7 @@
#include "guichan/widget.h"
namespace gcn
{
{
/**
* A slider able to slide between different values. You can set the scale
* of the slider yourself so that it ranges between, for example, -1.0 and
@ -70,7 +70,7 @@ namespace gcn
public MouseListener,
public KeyListener
{
public:
public:
/**
* Constructor. Scale start is 0.
@ -96,8 +96,8 @@ namespace gcn
* Sets the scale.
*
* @param scaleStart the start of the scale.
* @param scaleEnd the end of the scale.
*/
* @param scaleEnd the end of the scale.
*/
virtual void setScale(double scaleStart, double scaleEnd);
/**
@ -141,21 +141,21 @@ namespace gcn
* @param value a scale value.
*/
virtual void setValue(double value);
/**
* Draws the marker.
*
* @param graphics a graphics object to draw with.
*/
*/
virtual void drawMarker(gcn::Graphics* graphics);
/**
* Sets the length of the marker.
*
* @param length new length for the marker.
*/
virtual void setMarkerLength(int length);
/**
* Gets the length of the marker.
*
@ -174,7 +174,7 @@ namespace gcn
/**
* Gets the orientation of the slider. Se the enum in this class.
*
* @return the orientation of the slider.
* @return the orientation of the slider.
*/
virtual unsigned int getOrientation() const;
@ -193,20 +193,20 @@ namespace gcn
*/
virtual double getStepLength() const;
// Inherited from Widget
virtual void draw(gcn::Graphics* graphics);
virtual void drawBorder(gcn::Graphics* graphics);
virtual void lostFocus();
// Inherited from MouseListener.
virtual void mousePress(int x, int y, int button);
virtual void mouseRelease(int x, int y, int button);
virtual void mouseMotion(int x, int y);
@ -225,16 +225,16 @@ namespace gcn
HORIZONTAL = 0,
VERTICAL
};
protected:
/**
* Converts a marker position to a value.
*
*
* @param v the position to convert.
* @return the value corresponding to the position.
*/
virtual double markerPositionToValue(int v) const;
/**
* Converts a value to a marker position.
*
@ -249,14 +249,14 @@ namespace gcn
* @return the marker position for the current value.
*/
virtual int getMarkerPosition() const;
bool mMouseDrag;
double mValue;
double mStepLength;
int mMarkerLength;
double mScaleStart;
double mScaleEnd;
unsigned int mOrientation;
unsigned int mOrientation;
};
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -121,7 +121,7 @@ namespace gcn
*
* @return the number of rows in the text.
*/
virtual unsigned int getNumberOfRows() const;
virtual unsigned int getNumberOfRows() const;
/**
* Gets the caret position in the text.
@ -150,7 +150,7 @@ namespace gcn
* @param row the row number.
*/
virtual void setCaretRow(int row);
/**
* Gets the column the caret is in in the text.
*
@ -162,9 +162,9 @@ namespace gcn
* Sets the column the caret should be in in the text.
*
* @param column the column number.
*/
*/
virtual void setCaretColumn(int column);
/**
* Sets the row and the column the caret should be in in the text.
*
@ -182,9 +182,9 @@ namespace gcn
* Checks if the TextBox is editable.
*
* @return true it the TextBox is editable.
*/
*/
virtual bool isEditable() const;
/**
* Sets if the TextBox should be editable or not.
*
@ -209,30 +209,30 @@ namespace gcn
/**
* Sets the TextBox to be opaque.
*
* @param opaque true if the TextBox should be opaque.
* @param opaque true if the TextBox should be opaque.
*/
virtual void setOpaque(bool opaque);
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void fontChanged();
// Inherited from KeyListener
virtual bool keyPress(const Key& key);
// Inherited from MouseListener
virtual void mousePress(int x, int y, int button);
protected:
/**
* Draws the caret.
@ -242,18 +242,18 @@ namespace gcn
* @param y the y position.
*/
virtual void drawCaret(Graphics* graphics, int x, int y);
/**
* Adjusts the TextBox size to fit the font size.
*/
virtual void adjustSize();
std::vector<std::string> mTextRows;
int mCaretColumn;
int mCaretRow;
bool mEditable;
bool mOpaque;
};
};
}
#endif // end GCN_TEXTBOX_HPP

View file

@ -1,5 +1,5 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -93,14 +93,14 @@ namespace gcn
* Destructor.
*/
virtual ~Window();
/**
* Sets the Window caption.
*
* @param caption the Window caption.
*/
virtual void setCaption(const std::string& caption);
/**
* Gets the Window caption.
*
@ -121,7 +121,7 @@ namespace gcn
* @return alignment of caption.
*/
virtual unsigned int getAlignment() const;
/**
* Sets the content Widget.
*
@ -155,7 +155,7 @@ namespace gcn
* Sets the title bar height.
*
* @param height the title height value.
*/
*/
virtual void setTitleBarHeight(unsigned int height);
/**
@ -169,14 +169,14 @@ namespace gcn
* Sets the Window to be moveble.
*
* @param movable true or false.
*/
*/
virtual void setMovable(bool movable);
/**
* Check if the window is movable.
*
* @return true or false.
*/
*/
virtual bool isMovable() const;
/**
@ -198,7 +198,7 @@ namespace gcn
* @return true or false.
*/
virtual bool isOpaque();
/**
* Draws the content of the Window. This functions uses the
* getContentDimension to determin where to draw the content.
@ -206,8 +206,8 @@ namespace gcn
* @param graphics a Graphics object to draw with.
*/
virtual void drawContent(Graphics* graphics);
// Inherited from BasicContainer
virtual void moveToTop(Widget* widget);
@ -216,32 +216,32 @@ namespace gcn
virtual void getDrawSize(int& width, int& height, Widget* widget);
virtual void _announceDeath(Widget *widget);
virtual void _announceDeath(Widget *widget);
// Inherited from Widget
virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic();
virtual void _mouseInputMessage(const MouseInput &mouseInput);
virtual void _mouseOutMessage();
virtual void _setFocusHandler(FocusHandler* focusHandler);
// Inherited from MouseListener
// Inherited from MouseListener
virtual void mousePress(int x, int y, int button);
virtual void mouseRelease(int x, int y, int button);
virtual void mouseMotion(int x, int y);
virtual void setDirty(bool dirty);
virtual bool getDirty() const;
@ -256,7 +256,7 @@ namespace gcn
* Gets the area in the window that the content occupies.
*/
virtual Rectangle getContentDimension();
std::string mCaption;
unsigned int mAlignment;
Widget* mContent;
@ -266,8 +266,8 @@ namespace gcn
int mMouseXOffset;
int mMouseYOffset;
bool mMovable;
bool mOpaque;
};
bool mOpaque;
};
}
#endif // end GCN_WINDOW_HPP

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/key.h"
@ -65,11 +65,11 @@ namespace gcn
mValue = 0;
mShiftPressed = false;
mControlPressed = false;
mAltPressed = false;
mAltPressed = false;
mMetaPressed = false;
mNumericPad = false;
mNumericPad = false;
}
Key::Key(int value)
{
mValue = value;
@ -77,7 +77,7 @@ namespace gcn
mControlPressed = false;
mAltPressed = false;
mMetaPressed = false;
mNumericPad = false;
mNumericPad = false;
}
bool Key::isCharacter() const
@ -91,20 +91,20 @@ namespace gcn
{
return mValue >= 48 && mValue <= 57;
}
bool Key::isLetter() const
{
return (((mValue >= 65 && mValue <= 90)
|| (mValue >= 97 && mValue <= 122)
|| (mValue >= 192 && mValue <= 255))
&& (mValue != 215) && (mValue != 247));
&& (mValue != 215) && (mValue != 247));
}
bool Key::isShiftPressed() const
{
return mShiftPressed;
}
void Key::setShiftPressed(bool pressed)
{
mShiftPressed = pressed;
@ -114,7 +114,7 @@ namespace gcn
{
return mControlPressed;
}
void Key::setControlPressed(bool pressed)
{
mControlPressed = pressed;
@ -124,7 +124,7 @@ namespace gcn
{
return mAltPressed;
}
void Key::setAltPressed(bool pressed)
{
mAltPressed = pressed;
@ -134,7 +134,7 @@ namespace gcn
{
return mMetaPressed;
}
void Key::setMetaPressed(bool pressed)
{
mMetaPressed = pressed;
@ -144,7 +144,7 @@ namespace gcn
{
return mNumericPad;
}
void Key::setNumericPad(bool numpad)
{
mNumericPad = numpad;
@ -157,7 +157,7 @@ namespace gcn
int Key::getValue() const
{
return mValue;
return mValue;
}
std::string Key::toString() const

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/keyinput.h"
@ -65,7 +65,7 @@ namespace gcn
mKey = key;
mType = type;
}
void KeyInput::setType(int type)
{
mType = type;
@ -84,6 +84,6 @@ namespace gcn
const Key& KeyInput::getKey() const
{
return mKey;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/mouseinput.h"
@ -68,7 +68,7 @@ namespace gcn
x = mousex;
y = mousey;
}
void MouseInput::setType(int type)
{
mType = type;

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/opengl.h"

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/rectangle.h"
@ -67,7 +67,7 @@ namespace gcn
width = 0;
height = 0;
}
Rectangle::Rectangle(int x, int y, int width, int height)
{
this->x = x;
@ -88,15 +88,15 @@ namespace gcn
{
x -= rectangle.x;
y -= rectangle.y;
if (x < 0)
{
{
width += x;
x = 0;
}
if (y < 0)
{
{
height += y;
y = 0;
}
@ -130,5 +130,5 @@ namespace gcn
return ((x >= this->x) && (y >= this->y)
&& x < (this->x + this->width)
&& y < (this->y + this->height));
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/gsdl.h"

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/exception.h"
@ -77,7 +77,7 @@ namespace gcn
{
mAlpha = false;
}
void SDLGraphics::_beginDraw()
{
Rectangle area;
@ -85,33 +85,33 @@ namespace gcn
area.y = 0;
area.width = mTarget->w;
area.height = mTarget->h;
pushClipArea(area);
pushClipArea(area);
}
void SDLGraphics::_endDraw()
{
popClipArea();
}
void SDLGraphics::setTarget(SDL_Surface* target)
{
mTarget = target;
mTarget = target;
}
bool SDLGraphics::pushClipArea(Rectangle area)
{
SDL_Rect rect;
bool result = Graphics::pushClipArea(area);
ClipRectangle carea = mClipStack.top();
rect.x = carea.x;
rect.y = carea.y;
rect.w = carea.width;
rect.h = carea.height;
SDL_SetClipRect(mTarget, &rect);
return result;
return result;
}
void SDLGraphics::popClipArea()
@ -123,21 +123,21 @@ namespace gcn
{
return;
}
ClipRectangle carea = mClipStack.top();
rect.x = carea.x;
rect.y = carea.y;
rect.w = carea.width;
rect.h = carea.height;
SDL_SetClipRect(mTarget, &rect);
SDL_SetClipRect(mTarget, &rect);
}
SDL_Surface* SDLGraphics::getTarget() const
{
return mTarget;
}
void SDLGraphics::drawImage(const Image* image, int srcX,
int srcY, int dstX, int dstY,
int width, int height)
@ -153,14 +153,14 @@ namespace gcn
dst.y = dstY + top.yOffset;
SDL_Surface* srcImage = (SDL_Surface*)image->_getData();
SDL_BlitSurface(srcImage, &src, mTarget, &dst);
SDL_BlitSurface(srcImage, &src, mTarget, &dst);
}
void SDLGraphics::fillRectangle(const Rectangle& rectangle)
{
{
Rectangle area = rectangle;
ClipRectangle top = mClipStack.top();
ClipRectangle top = mClipStack.top();
area.x += top.xOffset;
area.y += top.yOffset;
@ -187,10 +187,10 @@ namespace gcn
rect.y = area.y;
rect.w = area.width;
rect.h = area.height;
Uint32 color = SDL_MapRGBA(mTarget->format, mColor.r, mColor.g, mColor.b, mColor.a);
SDL_FillRect(mTarget, &rect, color);
}
}
}
void SDLGraphics::drawPoint(int x, int y)
@ -207,9 +207,9 @@ namespace gcn
SDLputPixelAlpha(mTarget, x, y, mColor);
}
else
{
{
SDLputPixel(mTarget, x, y, mColor);
}
}
}
void SDLGraphics::drawHLine(int x1, int y, int x2)
@ -221,7 +221,7 @@ namespace gcn
if (y < top.y || y >= top.y + top.height)
return;
if (x1 > x2)
{
x1 ^= x2;
@ -243,16 +243,16 @@ namespace gcn
if (top.x + top.width <= x1)
{
return;
}
}
x2 = top.x + top.width -1;
}
Uint32 color =
Uint32 color =
SDL_MapRGB(TheScreen->format, mColor.r, mColor.g, mColor.b);
if (mAlpha) {
Video.DrawTransHLine(color, x1, y, x2 - x1, mColor.a);
} else {
Video.DrawHLine(color, x1, y, x2 - x1);
}
}
}
void SDLGraphics::drawVLine(int x, int y1, int y2)
@ -264,7 +264,7 @@ namespace gcn
if (x < top.x || x >= top.x + top.width)
return;
if (y1 > y2)
{
y1 ^= y2;
@ -286,10 +286,10 @@ namespace gcn
if (top.y + top.height <= y1)
{
return;
}
}
y2 = top.y + top.height - 1;
}
Uint32 color =
Uint32 color =
SDL_MapRGB(TheScreen->format, mColor.r, mColor.g, mColor.b);
if (mAlpha) {
Video.DrawTransVLine(color, x, y1,y2 - y1, mColor.a);
@ -332,7 +332,7 @@ namespace gcn
y2 += top.yOffset;
// Draw a line with Bresenham
int dx = ABS(x2 - x1);
int dy = ABS(y2 - y1);
@ -348,16 +348,16 @@ namespace gcn
// swap y1, y2
y1 ^= y2;
y2 ^= y1;
y1 ^= y2;
y1 ^= y2;
}
if (y1 < y2)
{
int y = y1;
int p = 0;
for (int x = x1; x <= x2; x++)
{
{
if (top.isPointInRect(x, y))
{
if (mAlpha)
@ -365,13 +365,13 @@ namespace gcn
SDLputPixelAlpha(mTarget, x, y, mColor);
}
else
{
{
SDLputPixel(mTarget, x, y, mColor);
}
}
p += dy;
if (p * 2 >= dx)
{
y++;
@ -383,9 +383,9 @@ namespace gcn
{
int y = y1;
int p = 0;
for (int x = x1; x <= x2; x++)
{
{
if (top.isPointInRect(x, y))
{
if (mAlpha)
@ -393,19 +393,19 @@ namespace gcn
SDLputPixelAlpha(mTarget, x, y, mColor);
}
else
{
{
SDLputPixel(mTarget, x, y, mColor);
}
}
p += dy;
if (p * 2 >= dx)
{
y--;
p -= dx;
}
}
}
}
}
else
@ -420,16 +420,16 @@ namespace gcn
// swap x1, x2
x1 ^= x2;
x2 ^= x1;
x1 ^= x2;
x1 ^= x2;
}
if (x1 < x2)
{
int x = x1;
int p = 0;
for (int y = y1; y <= y2; y++)
{
{
if (top.isPointInRect(x, y))
{
if (mAlpha)
@ -437,13 +437,13 @@ namespace gcn
SDLputPixelAlpha(mTarget, x, y, mColor);
}
else
{
{
SDLputPixel(mTarget, x, y, mColor);
}
}
p += dx;
if (p * 2 >= dy)
{
x++;
@ -455,9 +455,9 @@ namespace gcn
{
int x = x1;
int p = 0;
for (int y = y1; y <= y2; y++)
{
{
if (top.isPointInRect(x, y))
{
if (mAlpha)
@ -465,33 +465,33 @@ namespace gcn
SDLputPixelAlpha(mTarget, x, y, mColor);
}
else
{
{
SDLputPixel(mTarget, x, y, mColor);
}
}
p += dx;
if (p * 2 >= dy)
{
x--;
p -= dy;
}
}
}
}
}
}
}
void SDLGraphics::setColor(const Color& color)
{
mColor = color;
mColor = color;
mAlpha = color.a != 255;
mAlpha = color.a != 255;
}
const Color& SDLGraphics::getColor()
{
return mColor;
return mColor;
}
void SDLGraphics::drawSDLSurface(SDL_Surface* surface, SDL_Rect source,
@ -500,7 +500,7 @@ namespace gcn
ClipRectangle top = mClipStack.top();
destination.x += top.xOffset;
destination.y += top.yOffset;
SDL_BlitSurface(surface, &source, mTarget, &destination);
SDL_BlitSurface(surface, &source, mTarget, &destination);
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#ifdef USE_SDL_IMAGE
#include <SDL/SDL_image.h>
@ -67,9 +67,9 @@ namespace gcn
SDLImageLoader::SDLImageLoader()
{
mCurrentImage = NULL;
mCurrentImage = NULL;
}
void SDLImageLoader::prepare(const std::string& filename)
{
if (mCurrentImage != NULL)
@ -96,27 +96,27 @@ namespace gcn
bmask = 0x00ff0000;
amask = 0xff000000;
#endif
mCurrentImage = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, 32,
rmask, gmask, bmask, amask);
if (mCurrentImage == NULL)
{
throw GCN_EXCEPTION(std::string("Not enough memory to load: ")+filename);
}
SDL_Surface* tmp2 = SDL_ConvertSurface(tmp, mCurrentImage->format, SDL_SWSURFACE);
SDL_FreeSurface(tmp);
SDL_FreeSurface(mCurrentImage);
mCurrentImage = tmp2;
mCurrentImage = tmp2;
}
void* SDLImageLoader::getRawData()
{
return mCurrentImage->pixels;
}
void* SDLImageLoader::finalize()
{
if (mCurrentImage == NULL)
@ -127,7 +127,7 @@ namespace gcn
int i;
bool hasPink = false;
bool hasAlpha = false;
for (i = 0; i < mCurrentImage->w * mCurrentImage->h; ++i)
{
if (((unsigned int*)mCurrentImage->pixels)[i] == SDL_MapRGB(mCurrentImage->format,255,0,255))
@ -136,11 +136,11 @@ namespace gcn
break;
}
}
for (i = 0; i < mCurrentImage->w * mCurrentImage->h; ++i)
{
Uint8 r, g, b, a;
SDL_GetRGBA(((unsigned int*)mCurrentImage->pixels)[i], mCurrentImage->format,
&r, &g, &b, &a);
@ -148,7 +148,7 @@ namespace gcn
{
hasAlpha = true;
break;
}
}
}
// Don't convert 32bpp images with alpha, it will destroy the
@ -165,7 +165,7 @@ namespace gcn
SDL_FreeSurface(mCurrentImage);
mCurrentImage = NULL;
}
if (hasPink)
{
SDL_SetColorKey(temp, SDL_SRCCOLORKEY,
@ -175,39 +175,39 @@ namespace gcn
{
SDL_SetAlpha(temp, SDL_SRCALPHA, 255);
}
return temp;
return temp;
}
void SDLImageLoader::discard()
{
if (mCurrentImage == NULL)
{
throw GCN_EXCEPTION("No image prepared.");
}
SDL_FreeSurface(mCurrentImage);
mCurrentImage = NULL;
mCurrentImage = NULL;
}
void SDLImageLoader::free(Image* image)
{
if (image->_getData() == NULL)
{
throw GCN_EXCEPTION("Image data points to null.");
}
SDL_FreeSurface((SDL_Surface*)image->_getData());
SDL_FreeSurface((SDL_Surface*)image->_getData());
}
int SDLImageLoader::getWidth() const
{
if (mCurrentImage == NULL)
{
throw GCN_EXCEPTION("No image prepared.");
}
return mCurrentImage->w;
}
@ -217,7 +217,7 @@ namespace gcn
{
throw GCN_EXCEPTION("No image prepared.");
}
return mCurrentImage->h;
}
@ -233,7 +233,7 @@ namespace gcn
throw GCN_EXCEPTION("x and y out of image bound.");
}
return SDLgetPixel(mCurrentImage, x, y);
return SDLgetPixel(mCurrentImage, x, y);
}
void SDLImageLoader::putPixel(int x, int y, const Color& color)
@ -247,8 +247,8 @@ namespace gcn
{
throw GCN_EXCEPTION("x and y out of image bound.");
}
SDLputPixel(mCurrentImage, x, y, color);
SDLputPixel(mCurrentImage, x, y, color);
}
}
#endif

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/sdl/sdlinput.h"
@ -67,26 +67,26 @@ namespace gcn
mMouseDown = false;
mIsRepeating = false;
}
bool SDLInput::isKeyQueueEmpty()
{
return mKeyInputQueue.empty();
}
KeyInput SDLInput::dequeueKeyInput()
{
KeyInput keyInput;
if (mKeyInputQueue.empty())
{
assert(!"The queue is empty.");
//throw GCN_EXCEPTION("The queue is empty.");
}
keyInput = mKeyInputQueue.front();
mKeyInputQueue.pop();
return keyInput;
return keyInput;
}
bool SDLInput::isMouseQueueEmpty()
@ -97,17 +97,17 @@ namespace gcn
MouseInput SDLInput::dequeueMouseInput()
{
MouseInput mouseInput;
if (mMouseInputQueue.empty())
{
assert(!"The queue is empty.");
//throw GCN_EXCEPTION("The queue is empty.");
}
mouseInput = mMouseInputQueue.front();
mMouseInputQueue.pop();
return mouseInput;
return mouseInput;
}
void SDLInput::processKeyRepeat()
@ -116,7 +116,7 @@ namespace gcn
if (mIsRepeating) {
keyInput.setKey(mLastKey);
keyInput.setType(KeyInput::PRESS);
keyInput.setType(KeyInput::PRESS);
mKeyInputQueue.push(keyInput);
}
}
@ -125,14 +125,14 @@ namespace gcn
{
KeyInput keyInput;
MouseInput mouseInput;
switch (event.type)
{
case SDL_KEYDOWN:
mLastKey = convertKeyCharacter(event.key.keysym);
mIsRepeating = true;
keyInput.setKey(mLastKey);
keyInput.setType(KeyInput::PRESS);
keyInput.setType(KeyInput::PRESS);
mKeyInputQueue.push(keyInput);
break;
@ -154,7 +154,7 @@ namespace gcn
break;
case SDL_MOUSEBUTTONUP:
mMouseDown = false;
mMouseDown = false;
mouseInput.x = event.button.x;
mouseInput.y = event.button.y;
mouseInput.setButton(convertMouseButton(event.button.button));
@ -162,7 +162,7 @@ namespace gcn
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
break;
case SDL_MOUSEMOTION:
mouseInput.x = event.button.x;
mouseInput.y = event.button.y;
@ -171,9 +171,9 @@ namespace gcn
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
break;
case SDL_ACTIVEEVENT:
/*
/*
* This occurs when the mouse leaves the window and the Gui-chan
* application loses its mousefocus.
*/
@ -181,7 +181,7 @@ namespace gcn
&& !event.active.gain)
{
mMouseInWindow = false;
if (!mMouseDown)
{
mouseInput.x = -1;
@ -198,10 +198,10 @@ namespace gcn
mMouseInWindow = true;
}
break;
} // end switch
}
int SDLInput::convertMouseButton(int button)
{
switch (button)
@ -221,7 +221,7 @@ namespace gcn
case SDL_BUTTON_WHEELDOWN:
return MouseInput::WHEEL_DOWN;
break;
}
}
#ifdef DEBUG
fprintf(stderr,"Unknown SDL mouse button.\n");
@ -232,9 +232,9 @@ namespace gcn
Key SDLInput::convertKeyCharacter(SDL_keysym keysym)
{
int value = 0;
int value = 0;
Key key;
if (keysym.unicode < 255)
{
if (keysym.unicode == 0)
@ -428,10 +428,10 @@ namespace gcn
break;
case SDLK_KP9:
value = Key::K_PAGE_UP;
break;
break;
default:
break;
}
}
}
key.setValue(value);
@ -444,7 +444,7 @@ namespace gcn
{
key.setNumericPad(true);
}
return key;
return key;
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/basiccontainer.h"
@ -93,7 +93,7 @@ namespace gcn
mFocusHandler = NULL;
mFocusable = false;
mClickTimeStamp = 0;
mClickCount = 0;
mClickCount = 0;
mHasMouse = false;
mVisible = true;
mTabIn = true;
@ -101,9 +101,9 @@ namespace gcn
mEnabled = true;
mClickButton = 0;
mHotKey = 0;
mCurrentFont = NULL;
mWidgets.push_back(this);
mWidgets.push_back(this);
mDirty = true;
}
@ -113,9 +113,9 @@ namespace gcn
{
getParent()->_announceDeath(this);
}
_setFocusHandler(NULL);
mWidgets.remove(this);
}
@ -126,7 +126,7 @@ namespace gcn
BasicContainer* Widget::getParent() const
{
return mParent;
return mParent;
}
void Widget::setWidth(int width)
@ -168,7 +168,7 @@ namespace gcn
{
return mDimension.y;
}
void Widget::setPosition(int x, int y)
{
mDimension.x = x;
@ -189,12 +189,12 @@ namespace gcn
{
return mBorderSize;
}
const Rectangle& Widget::getDimension() const
{
return mDimension;
}
const std::string& Widget::getEventId() const
{
return mEventId;
@ -204,7 +204,7 @@ namespace gcn
{
mEventId = eventId;
}
bool Widget::hasFocus() const
{
if (!mFocusHandler)
@ -226,15 +226,15 @@ namespace gcn
{
mFocusHandler->focusNone();
}
mFocusable = focusable;
}
bool Widget::isFocusable() const
{
return mFocusable && isVisible() && isEnabled();
return mFocusable && isVisible() && isEnabled();
}
void Widget::requestFocus()
{
if (mFocusHandler == NULL)
@ -242,7 +242,7 @@ namespace gcn
//throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?).");
assert(!"No focushandler set (did you add the widget to the gui?).");
}
if (isFocusable())
{
mFocusHandler->requestFocus(this);
@ -262,7 +262,7 @@ namespace gcn
if (mParent)
{
mParent->moveToBottom(this);
}
}
}
void Widget::setVisible(bool visible)
@ -270,20 +270,20 @@ namespace gcn
if (!visible && hasFocus())
{
mFocusHandler->focusNone();
}
}
mVisible = visible;
}
bool Widget::isVisible() const
{
if (getParent() == NULL)
{
{
return mVisible;
}
else
{
return mVisible && getParent()->isVisible();
}
}
}
void Widget::setBaseColor(const Color& color)
@ -305,7 +305,7 @@ namespace gcn
{
return mForegroundColor;
}
void Widget::setBackgroundColor(const Color& color)
{
mBackgroundColor = color;
@ -333,12 +333,12 @@ namespace gcn
releaseModalFocus();
mFocusHandler->remove(this);
}
if (focusHandler)
{
focusHandler->add(this);
}
mFocusHandler = focusHandler;
}
@ -349,34 +349,34 @@ namespace gcn
void Widget::addActionListener(ActionListener* actionListener)
{
mActionListeners.push_back(actionListener);
mActionListeners.push_back(actionListener);
}
void Widget::removeActionListener(ActionListener* actionListener)
{
mActionListeners.remove(actionListener);
mActionListeners.remove(actionListener);
}
void Widget::addKeyListener(KeyListener* keyListener)
{
mKeyListeners.push_back(keyListener);
mKeyListeners.push_back(keyListener);
}
void Widget::removeKeyListener(KeyListener* keyListener)
{
mKeyListeners.remove(keyListener);
mKeyListeners.remove(keyListener);
}
void Widget::addMouseListener(MouseListener* mouseListener)
{
mMouseListeners.push_back(mouseListener);
mMouseListeners.push_back(mouseListener);
}
void Widget::removeMouseListener(MouseListener* mouseListener)
{
mMouseListeners.remove(mouseListener);
mMouseListeners.remove(mouseListener);
}
void Widget::_mouseInputMessage(const MouseInput& mouseInput)
{
if (mFocusHandler == NULL)
@ -384,20 +384,20 @@ namespace gcn
//throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?).");
assert(!"No focushandler set (did you add the widget to the gui?).");
}
if (!mEnabled || (mFocusHandler->getModalFocused() != NULL &&
!hasModalFocus()))
{
return;
}
int x = mouseInput.x;
int y = mouseInput.y;
int b = mouseInput.getButton();
int ts = mouseInput.getTimeStamp();
MouseListenerIterator iter;
switch(mouseInput.getType())
{
case MouseInput::MOTION:
@ -406,17 +406,17 @@ namespace gcn
(*iter)->mouseMotion(x, y);
}
break;
case MouseInput::PRESS:
if (hasMouse())
{
requestFocus();
mFocusHandler->requestDrag(this);
}
if (b != MouseInput::WHEEL_UP && b != MouseInput::WHEEL_DOWN)
{
for (iter = mMouseListeners.begin(); iter != mMouseListeners.end(); ++iter)
{
(*iter)->mousePress(x, y, b);
@ -462,7 +462,7 @@ namespace gcn
{
mFocusHandler->dragNone();
}
if (b != MouseInput::WHEEL_UP && b != MouseInput::WHEEL_DOWN)
{
for (iter = mMouseListeners.begin(); iter != mMouseListeners.end(); ++iter)
@ -483,7 +483,7 @@ namespace gcn
else
{
mClickButton = 0;
mClickCount = 0;
mClickCount = 0;
}
}
else
@ -493,7 +493,7 @@ namespace gcn
}
setDirty(true);
break;
}
}
}
bool Widget::_keyInputMessage(const KeyInput& keyInput)
@ -503,16 +503,16 @@ namespace gcn
//throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?).");
assert(!"No focushandler set (did you add the widget to the gui?).");
}
if (!mEnabled || (mFocusHandler->getModalFocused() != NULL &&
!hasModalFocus()))
{
return false;
}
KeyListenerIterator iter;
bool keyProcessed = false;
switch(keyInput.getType())
{
case KeyInput::PRESS:
@ -524,7 +524,7 @@ namespace gcn
}
}
break;
case KeyInput::RELEASE:
for (iter = mKeyListeners.begin(); iter != mKeyListeners.end(); ++iter)
{
@ -532,7 +532,7 @@ namespace gcn
{
keyProcessed = true;
}
}
}
break;
}
@ -553,7 +553,7 @@ namespace gcn
for (iter = mMouseListeners.begin(); iter != mMouseListeners.end(); ++iter)
{
(*iter)->mouseIn();
}
}
}
void Widget::_mouseOutMessage()
@ -565,7 +565,7 @@ namespace gcn
for (iter = mMouseListeners.begin(); iter != mMouseListeners.end(); ++iter)
{
(*iter)->mouseOut();
}
}
}
void Widget::getAbsolutePosition(int& x, int& y) const
@ -583,18 +583,18 @@ namespace gcn
getParent()->getAbsolutePosition(parentX, parentY);
x = parentX + mDimension.x;
y = parentY + mDimension.y;
y = parentY + mDimension.y;
}
void Widget::generateAction()
{
ActionListenerIterator iter;
for (iter = mActionListeners.begin(); iter != mActionListeners.end(); ++iter)
{
(*iter)->action(mEventId);
}
}
}
Font* Widget::getFont() const
{
if (mCurrentFont == NULL)
@ -605,15 +605,15 @@ namespace gcn
}
return mGlobalFont;
}
}
return mCurrentFont;
}
void Widget::setGlobalFont(Font* font)
{
mGlobalFont = font;
std::list<Widget*>::iterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
@ -621,14 +621,14 @@ namespace gcn
{
(*iter)->fontChanged();
}
}
}
}
void Widget::setFont(Font* font)
{
mCurrentFont = font;
fontChanged();
}
fontChanged();
}
void Widget::setHotKey(const int key)
{
@ -658,7 +658,7 @@ namespace gcn
bool Widget::widgetExists(const Widget* widget)
{
bool result = false;
std::list<Widget*>::iterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
@ -675,7 +675,7 @@ namespace gcn
{
return mTabIn;
}
void Widget::setTabInEnabled(bool enabled)
{
mTabIn = enabled;
@ -685,7 +685,7 @@ namespace gcn
{
return mTabOut;
}
void Widget::setTabOutEnabled(bool enabled)
{
mTabOut = enabled;
@ -714,9 +714,9 @@ namespace gcn
assert(!"No focushandler set (did you add the widget to the gui?).");
//throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?).");
}
return mFocusHandler->isDragged(this);
}
}
void Widget::requestModalFocus()
{
@ -738,7 +738,7 @@ namespace gcn
mFocusHandler->releaseModalFocus(this);
}
bool Widget::hasModalFocus() const
{
if (mFocusHandler == NULL)

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/widgets/button.h"
@ -68,9 +68,9 @@ namespace gcn
addMouseListener(this);
addKeyListener(this);
adjustSize();
setBorderSize(1);
setBorderSize(1);
}
Button::Button(const std::string& caption)
{
mCaption = caption;
@ -78,13 +78,13 @@ namespace gcn
setFocusable(true);
adjustSize();
setBorderSize(1);
mMouseDown = false;
mKeyDown = false;
mHotKeyDown = false;
addMouseListener(this);
addKeyListener(this);
addKeyListener(this);
}
void Button::setCaption(const std::string& caption)
@ -95,7 +95,7 @@ namespace gcn
const std::string& Button::getCaption() const
{
return mCaption;
return mCaption;
}
void Button::setAlignment(unsigned int alignment)
@ -107,20 +107,20 @@ namespace gcn
{
return mAlignment;
}
void Button::draw(Graphics* graphics)
{
Color faceColor = getBaseColor();
Color highlightColor, shadowColor;
int alpha = getBaseColor().a;
if (isPressed())
{
faceColor = faceColor - 0x303030;
faceColor.a = alpha;
highlightColor = faceColor - 0x303030;
highlightColor.a = alpha;
shadowColor = faceColor + 0x303030;
shadowColor = faceColor + 0x303030;
shadowColor.a = alpha;
}
else if (isEnabled())
@ -141,13 +141,13 @@ namespace gcn
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, getWidth() - 1, 0);
graphics->drawLine(0, 1, 0, getHeight() - 1);
//graphics->drawHLine(0, 0, getWidth() - 1);
//graphics->drawVLine(0, 1, 0, getHeight() - 1);
graphics->setColor(shadowColor);
graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1);
graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1);
@ -158,7 +158,7 @@ namespace gcn
int textX;
int textY = getHeight() / 2 - getFont()->getHeight() / 2;
switch (getAlignment())
{
case Graphics::LEFT:
@ -176,7 +176,7 @@ namespace gcn
}
graphics->setFont(getFont());
if (isPressed())
{
graphics->drawText(getCaption(), textX + 1, textY + 1, getAlignment());
@ -184,13 +184,13 @@ namespace gcn
else
{
graphics->drawText(getCaption(), textX, textY, getAlignment());
if (hasFocus())
{
graphics->drawRectangle(Rectangle(2, 2, getWidth() - 4,
getHeight() - 4));
}
}
}
}
}
void Button::drawBorder(Graphics* graphics)
@ -212,11 +212,11 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void Button::adjustSize()
{
setWidth(getFont()->getWidth(mCaption) + 8);
@ -227,7 +227,7 @@ namespace gcn
{
return (hasMouse() && mMouseDown) || mKeyDown || mHotKeyDown;
}
void Button::mouseClick(int, int, int button, int)
{
if (button == MouseInput::LEFT)
@ -239,7 +239,7 @@ namespace gcn
void Button::mousePress(int, int, int button)
{
if (button == MouseInput::LEFT && hasMouse())
{
{
mMouseDown = true;
}
}
@ -247,11 +247,11 @@ namespace gcn
void Button::mouseRelease(int, int, int button)
{
if (button == MouseInput::LEFT)
{
{
mMouseDown = false;
}
}
bool Button::keyPress(const Key& key)
{
bool ret = false;
@ -300,5 +300,5 @@ namespace gcn
mMouseDown = false;
mKeyDown = false;
mHotKeyDown = false;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,23 +53,23 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/widgets/checkbox.h"
namespace gcn
{
CheckBox::CheckBox()
{
setMarked(false);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
}
CheckBox::CheckBox(const std::string &caption, bool marked)
{
setCaption(caption);
@ -81,7 +81,7 @@ namespace gcn
adjustSize();
}
void CheckBox::draw(Graphics* graphics)
{
drawBox(graphics);
@ -94,9 +94,9 @@ namespace gcn
graphics->drawText(getCaption(), h - 2, 0);
if (hasFocus() && !getCaption().empty())
{
{
graphics->drawRectangle(Rectangle(h - 4, 0, getWidth() - h + 3, getHeight()));
}
}
}
void CheckBox::drawBorder(Graphics* graphics)
@ -110,7 +110,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -118,8 +118,8 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
@ -132,7 +132,7 @@ namespace gcn
faceColor.a = alpha;
Color highlightColor = faceColor + 0x303030;
highlightColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(shadowColor);
@ -147,22 +147,22 @@ namespace gcn
graphics->fillRectangle(Rectangle(1, 1, h - 1, h - 1));
graphics->setColor(getForegroundColor());
if (mMarked)
{
graphics->drawLine(3, 5, 3, h - 3);
graphics->drawLine(4, 5, 4, h - 3);
graphics->drawLine(5, h - 4, h - 2, 3);
graphics->drawLine(5, h - 5, h - 4, 4);
}
graphics->drawLine(5, h - 5, h - 4, 4);
}
}
bool CheckBox::isMarked() const
{
return mMarked;
}
return mMarked;
}
void CheckBox::setMarked(bool marked)
{
mMarked = marked;
@ -178,7 +178,7 @@ namespace gcn
mCaption = caption;
setDirty(true);
}
bool CheckBox::keyPress(const Key& key)
{
if (key.getValue() == Key::K_ENTER ||
@ -189,7 +189,7 @@ namespace gcn
}
return false;
}
void CheckBox::mouseClick(int, int, int button, int)
{
if (button == MouseInput::LEFT)
@ -197,7 +197,7 @@ namespace gcn
toggle();
}
}
void CheckBox::adjustSize()
{
int height = getFont()->getHeight();
@ -210,6 +210,6 @@ namespace gcn
{
mMarked = !mMarked;
generateAction();
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/exception.h"
@ -65,19 +65,19 @@ namespace gcn
Container::Container()
{
mWidgetWithMouse = NULL;
mOpaque = true;
mOpaque = true;
}
Container::~Container()
{
clear();
clear();
}
void Container::logic()
{
logicChildren();
}
void Container::draw(Graphics* graphics)
{
if (isOpaque())
@ -85,7 +85,7 @@ namespace gcn
graphics->setColor(getBaseColor());
graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
}
drawChildren(graphics);
}
@ -100,7 +100,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -108,11 +108,11 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void Container::logicChildren()
{
WidgetIterator iter;
@ -121,7 +121,7 @@ namespace gcn
(*iter)->logic();
}
}
void Container::drawChildren(Graphics* graphics)
{
WidgetIterator iter;
@ -137,12 +137,12 @@ namespace gcn
rec.x -= (*iter)->getBorderSize();
rec.y -= (*iter)->getBorderSize();
rec.width += 2 * (*iter)->getBorderSize();
rec.height += 2 * (*iter)->getBorderSize();
rec.height += 2 * (*iter)->getBorderSize();
graphics->pushClipArea(rec);
(*iter)->drawBorder(graphics);
graphics->popClipArea();
}
graphics->pushClipArea((*iter)->getDimension());
(*iter)->draw(graphics);
graphics->popClipArea();
@ -198,7 +198,7 @@ namespace gcn
{
mWidgetWithMouse = NULL;
}
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
@ -211,7 +211,7 @@ namespace gcn
assert(!"There is no such widget in this container.");
//throw GCN_EXCEPTION("There is no such widget in this container.");
}
void Container::getDrawSize(int& width, int& height, Widget* widget)
{
WidgetIterator iter;
@ -225,7 +225,7 @@ namespace gcn
break;
}
}
if (contains)
{
Rectangle widgetDim = widget->getDimension();
@ -268,9 +268,9 @@ namespace gcn
{
assert(!"Widget not in container.");
//throw GCN_EXCEPTION("Widget not in container.");
}
}
}
void Container::add(Widget* widget)
{
mWidgets.push_back(widget);
@ -290,7 +290,7 @@ namespace gcn
{
mWidgetWithMouse = NULL;
}
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
@ -307,36 +307,36 @@ namespace gcn
}
void Container::clear()
{
{
mWidgetWithMouse = NULL;
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
{
(*iter)->_setFocusHandler(NULL);
(*iter)->_setParent(NULL);
}
mWidgets.clear();
}
void Container::_setFocusHandler(FocusHandler* focusHandler)
{
Widget::_setFocusHandler(focusHandler);
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
(*iter)->_setFocusHandler(focusHandler);
}
}
}
void Container::_mouseInputMessage(const MouseInput &mouseInput)
{
{
Widget* tempWidgetWithMouse = NULL;
WidgetIterator iter;
WidgetIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
if ((*iter)->getDimension().isPointInRect(mouseInput.x, mouseInput.y)
@ -360,19 +360,19 @@ namespace gcn
mWidgetWithMouse = tempWidgetWithMouse;
}
if (mWidgetWithMouse != NULL)
{
MouseInput mi = mouseInput;
mi.x -= mWidgetWithMouse->getX();
mi.y -= mWidgetWithMouse->getY();
mi.y -= mWidgetWithMouse->getY();
mWidgetWithMouse->_mouseInputMessage(mi);
}
if (mWidgetWithMouse == NULL)
{
BasicContainer::_mouseInputMessage(mouseInput);
}
}
}
void Container::_mouseOutMessage()

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -51,19 +51,19 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include "guichan/exception.h"
#include "guichan/widgets/dropdown.h"
namespace gcn
{
{
DropDown::DropDown()
{
mDroppedDown = false;
mPushed = false;
mOldH = 0;
setWidth(100);
setFocusable(true);
@ -74,25 +74,25 @@ namespace gcn
mScrollArea = mDefaultScrollArea;
mScrollArea->_setFocusHandler(&mFocusHandler);
mScrollArea->_setParent(this);
mListBox = mDefaultListBox;
mListBox = mDefaultListBox;
mListBox->addActionListener(this);
mScrollArea->setContent(mListBox);
addMouseListener(this);
addKeyListener(this);
adjustHeight();
setBorderSize(1);
setBorderSize(1);
}
DropDown::DropDown(ListModel *listModel)
{
setWidth(100);
setFocusable(true);
mDroppedDown = false;
mPushed = false;
mPushed = false;
mOldH = 0;
mDefaultScrollArea = new ScrollArea();
mDefaultScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mDefaultListBox = new ListBox();
@ -101,13 +101,13 @@ namespace gcn
mScrollArea->_setParent(this);
mListBox = mDefaultListBox;
mListBox->addActionListener(this);
mScrollArea->setContent(mListBox);
mScrollArea->_setFocusHandler(&mFocusHandler);
mScrollArea->_setParent(this);
setListModel(listModel);
if (mListBox->getSelected() < 0)
{
mListBox->setSelected(0);
@ -116,9 +116,9 @@ namespace gcn
addMouseListener(this);
addKeyListener(this);
adjustHeight();
setBorderSize(1);
setBorderSize(1);
}
DropDown::DropDown(ListModel *listModel,
ScrollArea *scrollArea,
ListBox *listBox)
@ -128,18 +128,18 @@ namespace gcn
mDroppedDown = false;
mPushed = false;
mOldH = 0;
mDefaultScrollArea = NULL;
mDefaultListBox = NULL;
mScrollArea = scrollArea;
mScrollArea->_setFocusHandler(&mFocusHandler);
mListBox = listBox;
mListBox = listBox;
mListBox->addActionListener(this);
mScrollArea->setContent(mListBox);
mScrollArea->_setParent(this);
setListModel(listModel);
if (mListBox->getSelected() < 0)
@ -150,11 +150,11 @@ namespace gcn
addMouseListener(this);
addKeyListener(this);
adjustHeight();
setBorderSize(1);
setBorderSize(1);
}
DropDown::~DropDown()
{
{
if (mScrollArea != NULL)
{
mScrollArea->_setFocusHandler(NULL);
@ -175,7 +175,7 @@ namespace gcn
mListBox->removeActionListener(this);
}
}
void DropDown::logic()
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -183,13 +183,13 @@ namespace gcn
//throw GCN_EXCEPTION("ScrollArea or ListBox is NULL.");
assert(!"ScrollArea or ListBox is NULL.");
}
mScrollArea->logic();
mFocusHandler.applyChanges();
}
void DropDown::draw(Graphics* graphics)
{
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
{
//throw GCN_EXCEPTION("ScrollArea or ListBox is NULL.");
@ -206,22 +206,22 @@ namespace gcn
{
h = getHeight();
}
int alpha = getBaseColor().a;
Color faceColor = getBaseColor();
faceColor.a = alpha;
Color highlightColor = faceColor + 0x303030;
highlightColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(Rectangle(0, 0, getWidth(), h));
graphics->setColor(getForegroundColor());
graphics->setFont(getFont());
if (mListBox->getListModel() && mListBox->getSelected() >= 0)
{
graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()),
@ -232,9 +232,9 @@ namespace gcn
{
graphics->drawRectangle(Rectangle(0, 0, getWidth() - h, h));
}
drawButton(graphics);
if (mDroppedDown)
{
graphics->pushClipArea(mScrollArea->getDimension());
@ -247,7 +247,7 @@ namespace gcn
graphics->drawLine(0, h, getWidth(), h);
graphics->setColor(shadowColor);
graphics->drawLine(0, h + 1,getWidth(),h + 1);
}
}
}
void DropDown::drawBorder(Graphics* graphics)
@ -261,7 +261,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -269,8 +269,8 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
@ -279,7 +279,7 @@ namespace gcn
Color faceColor, highlightColor, shadowColor;
int offset;
int alpha = getBaseColor().a;
if (mPushed)
{
faceColor = getBaseColor() - 0x303030;
@ -311,7 +311,7 @@ namespace gcn
h = getHeight();
}
int x = getWidth() - h;
int y = 0;
int y = 0;
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(x+1, y+1, h-2, h-2));
@ -325,7 +325,7 @@ namespace gcn
graphics->drawLine(x+1, y+h-1, x+h-2, y+h-1);
graphics->setColor(getForegroundColor());
int i;
int hh = h / 3;
int hx = x + h / 2;
@ -336,9 +336,9 @@ namespace gcn
hy - i + offset,
hx + i + offset,
hy - i + offset);
}
}
}
int DropDown::getSelected()
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -347,9 +347,9 @@ namespace gcn
//throw GCN_EXCEPTION("ScrollArea or ListBox is NULL.");
}
return mListBox->getSelected();
return mListBox->getSelected();
}
void DropDown::setSelected(int selected)
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -361,9 +361,9 @@ namespace gcn
if (selected >= 0)
{
mListBox->setSelected(selected);
}
}
}
bool DropDown::keyPress(const Key& key)
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -380,7 +380,7 @@ namespace gcn
}
return false;
}
void DropDown::mousePress(int, int y, int button)
{
if (button == MouseInput::LEFT && hasMouse() && !mDroppedDown)
@ -397,17 +397,17 @@ namespace gcn
else if (!hasMouse())
{
foldUp();
}
}
}
void DropDown::mouseRelease(int, int, int button)
{
if (button == MouseInput::LEFT)
{
{
mPushed = false;
}
}
void DropDown::setListModel(ListModel *listModel)
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -417,15 +417,15 @@ namespace gcn
}
mListBox->setListModel(listModel);
if (mListBox->getSelected() < 0)
{
mListBox->setSelected(0);
}
adjustHeight();
adjustHeight();
}
ListModel *DropDown::getListModel()
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -433,8 +433,8 @@ namespace gcn
//throw GCN_EXCEPTION("ScrollArea or ListBox is NULL.");
assert(!"ScrollArea or ListBox is NULL.");
}
return mListBox->getListModel();
return mListBox->getListModel();
}
void DropDown::setScrollArea(ScrollArea *scrollArea)
@ -445,14 +445,14 @@ namespace gcn
mScrollArea->_setFocusHandler(&mFocusHandler);
mScrollArea->setContent(mListBox);
mScrollArea->_setParent(this);
adjustHeight();
adjustHeight();
}
ScrollArea *DropDown::getScrollArea()
{
return mScrollArea;
return mScrollArea;
}
void DropDown::setListBox(ListBox *listBox)
{
listBox->setSelected(mListBox->getSelected());
@ -463,22 +463,22 @@ namespace gcn
{
mListBox->removeActionListener(this);
}
mListBox = listBox;
mScrollArea->setContent(mListBox);
if (mListBox->getSelected() < 0)
{
mListBox->setSelected(0);
}
}
}
ListBox *DropDown::getListBox()
{
return mListBox;
return mListBox;
}
void DropDown::adjustHeight()
{
if (mScrollArea == NULL || mScrollArea->getContent() == NULL)
@ -494,11 +494,11 @@ namespace gcn
// The addition/subtraction of 2 compensates for the seperation lines
// seperating the selected element view and the scroll area.
if (mDroppedDown && getParent())
{
int h = getParent()->getHeight() - getY();
if (listBoxHeight > h - h2 - 2)
{
mScrollArea->setHeight(h - h2 - 2);
@ -512,11 +512,11 @@ namespace gcn
}
mScrollArea->setWidth(getWidth());
mScrollArea->setPosition(0, h2 + 2);
mScrollArea->setPosition(0, h2 + 2);
}
void DropDown::dropDown()
{
{
if (!mDroppedDown)
{
mDroppedDown = true;
@ -528,18 +528,18 @@ namespace gcn
getParent()->moveToTop(this);
}
}
mFocusHandler.requestFocus(mScrollArea->getContent());
}
void DropDown::foldUp()
{
{
if (mDroppedDown)
{
mDroppedDown = false;
mFocusHandler.focusNone();
adjustHeight();
}
}
}
bool DropDown::_keyInputMessage(const KeyInput& keyInput)
@ -564,11 +564,11 @@ namespace gcn
else
{
return BasicContainer::_keyInputMessage(keyInput);
}
}
}
void DropDown::_mouseInputMessage(const MouseInput &mouseInput)
{
{
BasicContainer::_mouseInputMessage(mouseInput);
if (mDroppedDown)
@ -578,11 +578,11 @@ namespace gcn
//throw GCN_EXCEPTION("ScrollArea or ListBox is NULL.");
assert(!"ScrollArea or ListBox is NULL.");
}
if (mouseInput.y >= mOldH)
{
MouseInput mi = mouseInput;
mi.y -= mScrollArea->getY();
mi.y -= mScrollArea->getY();
mScrollArea->_mouseInputMessage(mi);
if (mListBox->hasFocus())
@ -591,12 +591,12 @@ namespace gcn
mListBox->_mouseInputMessage(mi);
}
}
}
}
}
void DropDown::lostFocus()
{
foldUp();
foldUp();
}
void DropDown::moveToTop(Widget*)
@ -604,7 +604,7 @@ namespace gcn
if (getParent())
{
getParent()->moveToTop(this);
}
}
}
void DropDown::moveToBottom(Widget*)
@ -612,27 +612,27 @@ namespace gcn
if (getParent())
{
getParent()->moveToBottom(this);
}
}
}
void DropDown::_announceDeath(Widget* widget)
{
{
if (widget == mScrollArea)
{
{
mScrollArea = NULL;
}
else
{
assert(!"Death announced for unknown widget..");
//throw GCN_EXCEPTION("Death announced for unknown widget..");
}
}
}
void DropDown::action(const std::string&)
{
foldUp();
generateAction();
}
generateAction();
}
void DropDown::getDrawSize(int& width, int& height, Widget* widget)
{
@ -652,7 +652,7 @@ namespace gcn
{
assert(!"DropDown::getDrawSize. widget is not the ScrollArea (wieeerd...)");
//throw GCN_EXCEPTION("DropDown::getDrawSize. widget is not the ScrollArea (wieeerd...)");
}
}
}
void DropDown::setBaseColor(const Color& color)
@ -666,7 +666,7 @@ namespace gcn
{
mListBox->setBaseColor(color);
}
Widget::setBaseColor(color);
}
@ -681,7 +681,7 @@ namespace gcn
{
mListBox->setBackgroundColor(color);
}
Widget::setBackgroundColor(color);
}
@ -696,15 +696,15 @@ namespace gcn
{
mListBox->setForegroundColor(color);
}
Widget::setForegroundColor(color);
}
void DropDown::setFont(Font *font)
void DropDown::setFont(Font *font)
{
Widget::setFont(font);
mListBox->setFont(font);
}
}
bool DropDown::getDirty() const
{

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/rectangle.h"
@ -86,7 +86,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -94,8 +94,8 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/widgets/label.h"
@ -65,21 +65,21 @@ namespace gcn
{
mAlignment = Graphics::LEFT;
}
Label::Label(const std::string& caption)
{
mCaption = caption;
mAlignment = Graphics::LEFT;
setWidth(getFont()->getWidth(caption));
setHeight(getFont()->getHeight());
setHeight(getFont()->getHeight());
}
const std::string &Label::getCaption() const
{
return mCaption;
}
void Label::setCaption(const std::string& caption)
{
mCaption = caption;
@ -95,12 +95,12 @@ namespace gcn
{
return mAlignment;
}
void Label::draw(Graphics* graphics)
{
int textX;
int textY = getHeight() / 2 - getFont()->getHeight() / 2;
switch (getAlignment())
{
case Graphics::LEFT:
@ -121,7 +121,7 @@ namespace gcn
graphics->setColor(getForegroundColor());
graphics->drawText(getCaption(), textX, textY, getAlignment());
}
void Label::drawBorder(Graphics* graphics)
{
Color faceColor = getBaseColor();
@ -133,7 +133,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -141,8 +141,8 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
@ -150,5 +150,5 @@ namespace gcn
{
setWidth(getFont()->getWidth(getCaption()));
setHeight(getFont()->getHeight());
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <typeinfo>
@ -65,12 +65,12 @@
namespace gcn
{
ListBox::ListBox()
{
{
mSelected = -1;
mListModel = NULL;
setWidth(100);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
}
@ -81,42 +81,42 @@ namespace gcn
setWidth(100);
setListModel(listModel);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
}
void ListBox::draw(Graphics* graphics)
{
if (mListModel == NULL)
if (mListModel == NULL)
{
return;
}
graphics->setColor(getForegroundColor());
graphics->setFont(getFont());
graphics->setFont(getFont());
int i, fontHeight;
int y = 0;
fontHeight = getFont()->getHeight();
/**
* @todo Check cliprects so we do not have to iterate over elements in the list model
*/
for (i = 0; i < mListModel->getNumberOfElements(); ++i)
{
{
if (i == mSelected)
{
graphics->drawRectangle(Rectangle(0, y, getWidth(), fontHeight));
graphics->setColor(Color(40, 60, 120));
graphics->fillRectangle(Rectangle(1, y + 1, getWidth() - 2, fontHeight - 2));
}
graphics->drawText(mListModel->getElementAt(i), 1, y);
graphics->drawText(mListModel->getElementAt(i), 1, y);
y += fontHeight;
}
}
}
void ListBox::drawBorder(Graphics* graphics)
@ -130,7 +130,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -138,14 +138,14 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void ListBox::logic()
{
adjustSize();
adjustSize();
}
int ListBox::getSelected()
@ -178,8 +178,8 @@ namespace gcn
if (par == NULL)
{
return;
}
}
ScrollArea* scrollArea = dynamic_cast<ScrollArea *>(par);
if (scrollArea != NULL)
{
@ -201,7 +201,7 @@ namespace gcn
ret = true;
}
else if (key.getValue() == Key::K_UP)
{
{
setSelected(mSelected - 1);
if (mSelected == -1)
@ -232,19 +232,19 @@ namespace gcn
{
mSelected = -1;
mListModel = listModel;
adjustSize();
adjustSize();
}
ListModel* ListBox::getListModel()
{
return mListModel;
return mListModel;
}
void ListBox::adjustSize()
{
if (mListModel != NULL)
{
{
setHeight(getFont()->getHeight() * mListModel->getNumberOfElements());
}
}
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/widgets/radiobutton.h"
@ -61,16 +61,16 @@
namespace gcn
{
RadioButton::GroupMap RadioButton::mGroupMap;
RadioButton::RadioButton()
{
setMarked(false);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
addKeyListener(this);
}
RadioButton::RadioButton(const std::string &caption,
const std::string &group,
bool marked)
@ -85,30 +85,30 @@ namespace gcn
adjustSize();
}
RadioButton::~RadioButton()
{
// Remove us from the group list
setGroup("");
}
void RadioButton::draw(Graphics* graphics)
{
drawBox(graphics);
graphics->setFont(getFont());
graphics->setColor(getForegroundColor());
int h = getHeight() + getHeight() / 2;
graphics->drawText(getCaption(), h - 2, 0);
if (hasFocus())
{
{
graphics->drawRectangle(Rectangle(h - 4, 0, getWidth() - h + 3, getHeight()));
}
}
}
void RadioButton::drawBorder(Graphics* graphics)
{
Color faceColor = getBaseColor();
@ -120,7 +120,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -128,11 +128,11 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void RadioButton::drawBox(Graphics *graphics)
{
int h;
@ -148,17 +148,17 @@ namespace gcn
int alpha = getBaseColor().a;
Color faceColor = getBaseColor();
faceColor.a = alpha;
faceColor.a = alpha;
Color highlightColor = faceColor + 0x303030;
highlightColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
highlightColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(getBackgroundColor());
int i;
int hh = (h + 1) / 2;
for (i = 1; i <= hh; ++i)
{
graphics->drawLine(hh - i + 1,
@ -166,7 +166,7 @@ namespace gcn
hh + i - 1,
i);
}
for (i = 1; i < hh; ++i)
{
graphics->drawLine(hh - i + 1,
@ -174,37 +174,37 @@ namespace gcn
hh + i - 1,
h - i);
}
graphics->setColor(shadowColor);
graphics->drawLine(hh, 0, 0, hh);
graphics->drawLine(hh + 1, 1, h - 1, hh - 1);
graphics->setColor(highlightColor);
graphics->drawLine(1, hh + 1, hh, h);
graphics->drawLine(hh + 1, h - 1, h, hh);
graphics->setColor(getForegroundColor());
int hhh = hh - 3;
if (isMarked())
{
for (i = 0; i < hhh; ++i)
{
{
graphics->drawLine(hh - i, 4 + i, hh + i, 4 + i);
}
for (i = 0; i < hhh; ++i)
{
{
graphics->drawLine(hh - i, h - 4 - i, hh + i, h - 4 - i);
}
}
}
bool RadioButton::isMarked() const
{
return mMarked;
}
void RadioButton::setMarked(bool marked)
{
if (marked && mGroup != "")
@ -220,7 +220,7 @@ namespace gcn
{
iter->second->setMarked(false);
}
}
}
}
mMarked = marked;
@ -255,7 +255,7 @@ namespace gcn
{
setMarked(true);
generateAction();
}
}
}
void RadioButton::setGroup(const std::string &group)
@ -274,7 +274,7 @@ namespace gcn
mGroupMap.erase(iter);
break;
}
}
}
}
if (group != "")
@ -297,5 +297,5 @@ namespace gcn
setHeight(height);
setWidth(getFont()->getWidth(getCaption()) + height + height/2);
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/exception.h"
@ -120,14 +120,14 @@ namespace gcn
mHorizontalMarkerMousePosition = 0;
setContent(content);
addMouseListener(this);
addMouseListener(this);
}
ScrollArea::~ScrollArea()
{
setContent(NULL);
setContent(NULL);
}
void ScrollArea::setContent(Widget* widget)
{
if (mContent != NULL)
@ -135,7 +135,7 @@ namespace gcn
mContent->_setFocusHandler(NULL);
mContent->_setParent(NULL);
}
mContent = widget;
if (mContent != NULL)
@ -146,7 +146,7 @@ namespace gcn
checkPolicies();
}
Widget* ScrollArea::getContent()
{
return mContent;
@ -186,12 +186,12 @@ namespace gcn
int max = getVerticalMaxScroll();
mVScroll = vScroll;
if (vScroll > max)
{
mVScroll = max;
}
if (vScroll < 0)
{
mVScroll = 0;
@ -206,9 +206,9 @@ namespace gcn
void ScrollArea::setHorizontalScrollAmount(int hScroll)
{
int max = getHorizontalMaxScroll();
mHScroll = hScroll;
if (hScroll > max)
{
mHScroll = max;
@ -238,7 +238,7 @@ namespace gcn
{
return 0;
}
int value = mContent->getWidth() - getContentDimension().width + 2 * mContent->getBorderSize();
if (value < 0)
@ -247,7 +247,7 @@ namespace gcn
}
return value;
}
}
int ScrollArea::getVerticalMaxScroll()
{
@ -259,16 +259,16 @@ namespace gcn
}
int value;
value = mContent->getHeight() - getContentDimension().height + 2 * mContent->getBorderSize();
if (value < 0)
{
return 0;
}
return value;
}
}
void ScrollArea::setScrollbarWidth(int width)
{
@ -300,24 +300,24 @@ namespace gcn
void ScrollArea::_mouseInputMessage(const MouseInput &mouseInput)
{
BasicContainer::_mouseInputMessage(mouseInput);
BasicContainer::_mouseInputMessage(mouseInput);
if (getContentDimension().isPointInRect(mouseInput.x, mouseInput.y))
{
if (mContent != NULL)
{
if (!mContent->hasMouse())
{
mContent->_mouseInMessage();
mContent->_mouseInMessage();
}
MouseInput mi = mouseInput;
mi.x -= mContent->getX();
mi.y -= mContent->getY();
mContent->_mouseInputMessage(mi);
}
}
}
else if (mContent && mContent->hasMouse())
{
@ -331,10 +331,10 @@ namespace gcn
{
mContent->_mouseOutMessage();
}
BasicContainer::_mouseOutMessage();
}
void ScrollArea::mousePress(int x, int y, int)
{
if (getUpButtonDimension().isPointInRect(x, y))
@ -356,7 +356,7 @@ namespace gcn
{
setHorizontalScrollAmount(getHorizontalScrollAmount() + 10);
mRightButtonPressed = true;
}
}
else if (getVerticalMarkerDimension().isPointInRect(x, y))
{
mVerticalMarkerPressed = true;
@ -366,7 +366,7 @@ namespace gcn
{
mHorizontalMarkerPressed = true;
mHorizontalMarkerMousePosition = x - getHorizontalMarkerDimension().x;
}
}
}
void ScrollArea::mouseRelease(int, int, int)
@ -387,7 +387,7 @@ namespace gcn
int length = getVerticalMarkerDimension().height;
Rectangle barDim = getVerticalBarDimension();
if ((barDim.height - length) > 0)
{
setVerticalScrollAmount((getVerticalMaxScroll() * pos)
@ -405,7 +405,7 @@ namespace gcn
int length = getHorizontalMarkerDimension().width;
Rectangle barDim = getHorizontalBarDimension();
if ((barDim.width - length) > 0)
{
setHorizontalScrollAmount((getHorizontalMaxScroll() * pos)
@ -414,7 +414,7 @@ namespace gcn
else
{
setHorizontalScrollAmount(0);
}
}
setDirty(true);
}
}
@ -423,13 +423,13 @@ namespace gcn
{
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(getContentDimension());
int alpha = getBaseColor().a;
Color highlightColor = getBaseColor() + 0x303030;
highlightColor.a = alpha;
Color shadowColor = getBaseColor() - 0x303030;
highlightColor.a = alpha;
Color shadowColor = getBaseColor() - 0x303030;
shadowColor.a = alpha;
if (mVBarVisible)
{
drawUpButton(graphics);
@ -437,7 +437,7 @@ namespace gcn
drawVBar(graphics);
drawVMarker(graphics);
}
if (mHBarVisible)
{
drawLeftButton(graphics);
@ -445,7 +445,7 @@ namespace gcn
drawHBar(graphics);
drawHMarker(graphics);
}
if (mHBarVisible && mVBarVisible)
{
graphics->setColor(getBaseColor());
@ -457,7 +457,7 @@ namespace gcn
if (mContent)
{
Rectangle contdim = mContent->getDimension();
Rectangle contdim = mContent->getDimension();
graphics->pushClipArea(getContentDimension());
if (mContent->getBorderSize() > 0)
@ -466,12 +466,12 @@ namespace gcn
rec.x -= mContent->getBorderSize();
rec.y -= mContent->getBorderSize();
rec.width += 2 * mContent->getBorderSize();
rec.height += 2 * mContent->getBorderSize();
rec.height += 2 * mContent->getBorderSize();
graphics->pushClipArea(rec);
mContent->drawBorder(graphics);
graphics->popClipArea();
}
graphics->pushClipArea(contdim);
mContent->draw(graphics);
graphics->popClipArea();
@ -490,7 +490,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -498,11 +498,11 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void ScrollArea::drawHBar(Graphics* graphics)
{
Rectangle dim = getHorizontalBarDimension();
@ -514,16 +514,16 @@ namespace gcn
trackColor.a = alpha;
Color shadowColor = getBaseColor() - 0x303030;
shadowColor.a = alpha;
graphics->setColor(trackColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(shadowColor);
graphics->drawLine(0, 0, dim.width, 0);
graphics->popClipArea();
graphics->popClipArea();
}
void ScrollArea::drawVBar(Graphics* graphics)
{
Rectangle dim = getVerticalBarDimension();
@ -538,27 +538,27 @@ namespace gcn
graphics->setColor(trackColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(shadowColor);
graphics->drawLine(0, 0, 0, dim.height);
graphics->popClipArea();
}
void ScrollArea::drawUpButton(Graphics* graphics)
{
Rectangle dim = getUpButtonDimension();
graphics->pushClipArea(dim);
Color highlightColor;
Color shadowColor;
Color faceColor;
int offset;
int alpha = getBaseColor().a;
if (mUpButtonPressed)
{
faceColor = getBaseColor() - 0x303030;
faceColor = getBaseColor() - 0x303030;
faceColor.a = alpha;
highlightColor = faceColor - 0x303030;
highlightColor.a = alpha;
@ -579,19 +579,19 @@ namespace gcn
offset = 0;
}
graphics->setColor(faceColor);
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->setColor(getForegroundColor());
int i;
int w = dim.height / 2;
int h = w / 2 + 2;
@ -602,12 +602,12 @@ namespace gcn
w + i + offset,
i + h + offset);
}
graphics->popClipArea();
}
void ScrollArea::drawDownButton(Graphics* graphics)
{
{
Rectangle dim = getDownButtonDimension();
graphics->pushClipArea(dim);
@ -616,10 +616,10 @@ namespace gcn
Color faceColor;
int offset;
int alpha = getBaseColor().a;
if (mDownButtonPressed)
{
faceColor = getBaseColor() - 0x303030;
faceColor = getBaseColor() - 0x303030;
faceColor.a = alpha;
highlightColor = faceColor - 0x303030;
highlightColor.a = alpha;
@ -639,20 +639,20 @@ namespace gcn
offset = 0;
}
graphics->setColor(faceColor);
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->setColor(getForegroundColor());
int i;
int w = dim.height / 2;
int h = w + 1;
@ -661,9 +661,9 @@ namespace gcn
graphics->drawLine(w - i + offset,
-i + h + offset,
w + i + offset,
-i + h + offset);
-i + h + offset);
}
graphics->popClipArea();
}
@ -677,10 +677,10 @@ namespace gcn
Color faceColor;
int offset;
int alpha = getBaseColor().a;
if (mLeftButtonPressed)
{
faceColor = getBaseColor() - 0x303030;
faceColor = getBaseColor() - 0x303030;
faceColor.a = alpha;
highlightColor = faceColor - 0x303030;
highlightColor.a = alpha;
@ -700,18 +700,18 @@ namespace gcn
offset = 0;
}
graphics->setColor(faceColor);
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->setColor(getForegroundColor());
int i;
@ -722,9 +722,9 @@ namespace gcn
graphics->drawLine(i + h + offset,
w - i + offset,
i + h + offset,
w + i + offset);
w + i + offset);
}
graphics->popClipArea();
}
@ -738,10 +738,10 @@ namespace gcn
Color faceColor;
int offset;
int alpha = getBaseColor().a;
if (mRightButtonPressed)
{
faceColor = getBaseColor() - 0x303030;
faceColor = getBaseColor() - 0x303030;
faceColor.a = alpha;
highlightColor = faceColor - 0x303030;
highlightColor.a = alpha;
@ -761,20 +761,20 @@ namespace gcn
offset = 0;
}
graphics->setColor(faceColor);
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->setColor(getForegroundColor());
int i;
int w = dim.width / 2;
int h = w + 1;
@ -783,10 +783,10 @@ namespace gcn
graphics->drawLine(-i + h + offset,
w - i + offset,
-i + h + offset,
w + i + offset);
w + i + offset);
}
graphics->popClipArea();
graphics->popClipArea();
}
void ScrollArea::drawVMarker(Graphics* graphics)
@ -801,15 +801,15 @@ namespace gcn
highlightColor.a = alpha;
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(1, 1, dim.width - 1, dim.height - 1));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->setColor(shadowColor);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
@ -820,7 +820,7 @@ namespace gcn
{
Rectangle dim = getHorizontalMarkerDimension();
graphics->pushClipArea(dim);
int alpha = getBaseColor().a;
Color faceColor = getBaseColor();
faceColor.a = alpha;
@ -829,34 +829,34 @@ namespace gcn
Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(faceColor);
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(1, 1, dim.width - 1, dim.height - 1));
graphics->setColor(highlightColor);
graphics->drawLine(0, 0, dim.width - 1, 0);
graphics->drawLine(0, 1, 0, dim.height - 1);
graphics->setColor(shadowColor);
graphics->setColor(shadowColor);
graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
graphics->popClipArea();
}
void ScrollArea::logic()
{
checkPolicies();
setVerticalScrollAmount(getVerticalScrollAmount());
setHorizontalScrollAmount(getHorizontalScrollAmount());
if (mContent != NULL)
{
mContent->setPosition(-mHScroll + getContentDimension().x + mContent->getBorderSize(),
-mVScroll + getContentDimension().y + mContent->getBorderSize());
mContent->logic();
}
}
}
void ScrollArea::moveToTop(Widget* widget)
@ -916,9 +916,9 @@ namespace gcn
{
//throw GCN_EXCEPTION("Widget not in scrollarea.");
assert(!"Widget not in scrollarea.");
}
}
}
void ScrollArea::drawContent(Graphics* graphics)
{
if (mContent)
@ -926,23 +926,23 @@ namespace gcn
mContent->draw(graphics);
}
}
void ScrollArea::checkPolicies()
{
int w = getWidth();
int h = getHeight();
mHBarVisible = false;
mVBarVisible = false;
if (!mContent)
{
mHBarVisible = (mHPolicy == SHOW_ALWAYS);
mVBarVisible = (mVPolicy == SHOW_ALWAYS);
return;
}
if (mHPolicy == SHOW_AUTO &&
mVPolicy == SHOW_AUTO)
{
@ -968,10 +968,10 @@ namespace gcn
{
mHBarVisible = true;
}
return;
}
switch (mHPolicy)
{
case SHOW_NEVER:
@ -1030,7 +1030,7 @@ namespace gcn
{
return Rectangle(0, 0, 0, 0);
}
return Rectangle(getWidth() - mScrollbarWidth,
0,
mScrollbarWidth,
@ -1051,11 +1051,11 @@ namespace gcn
mScrollbarWidth,
mScrollbarWidth);
}
return Rectangle(getWidth() - mScrollbarWidth,
getHeight() - mScrollbarWidth,
mScrollbarWidth,
mScrollbarWidth);
mScrollbarWidth);
}
Rectangle ScrollArea::getLeftButtonDimension()
@ -1064,11 +1064,11 @@ namespace gcn
{
return Rectangle(0, 0, 0, 0);
}
return Rectangle(0,
getHeight() - mScrollbarWidth,
mScrollbarWidth,
mScrollbarWidth);
mScrollbarWidth);
}
Rectangle ScrollArea::getRightButtonDimension()
@ -1089,14 +1089,14 @@ namespace gcn
return Rectangle(getWidth() - mScrollbarWidth,
getHeight() - mScrollbarWidth,
mScrollbarWidth,
mScrollbarWidth);
mScrollbarWidth);
}
Rectangle ScrollArea::getContentDimension()
{
if (mVBarVisible && mHBarVisible)
{
return Rectangle(0, 0, getWidth() - mScrollbarWidth,
return Rectangle(0, 0, getWidth() - mScrollbarWidth,
getHeight() - mScrollbarWidth);
}
@ -1109,7 +1109,7 @@ namespace gcn
{
return Rectangle(0, 0, getWidth(), getHeight() - mScrollbarWidth);
}
return Rectangle(0, 0, getWidth(), getHeight());
}
@ -1125,19 +1125,19 @@ namespace gcn
return Rectangle(getWidth() - mScrollbarWidth,
getUpButtonDimension().height,
mScrollbarWidth,
getHeight()
getHeight()
- getUpButtonDimension().height
- getDownButtonDimension().height
- mScrollbarWidth);
}
return Rectangle(getWidth() - mScrollbarWidth,
getUpButtonDimension().height,
mScrollbarWidth,
getHeight()
getHeight()
- getUpButtonDimension().height
- getDownButtonDimension().height);
}
}
Rectangle ScrollArea::getHorizontalBarDimension()
{
@ -1150,16 +1150,16 @@ namespace gcn
{
return Rectangle(getLeftButtonDimension().width,
getHeight() - mScrollbarWidth,
getWidth()
getWidth()
- getLeftButtonDimension().width
- getRightButtonDimension().width
- mScrollbarWidth,
- mScrollbarWidth,
mScrollbarWidth);
}
return Rectangle(getLeftButtonDimension().width,
getHeight() - mScrollbarWidth,
getWidth()
getWidth()
- getLeftButtonDimension().width
- getRightButtonDimension().width,
mScrollbarWidth);
@ -1176,8 +1176,8 @@ namespace gcn
Rectangle barDim = getVerticalBarDimension();
if (mContent && mContent->getHeight() != 0)
{
length = (barDim.height * getContentDimension().height)
{
length = (barDim.height * getContentDimension().height)
/ mContent->getHeight();
}
else
@ -1204,7 +1204,7 @@ namespace gcn
{
pos = 0;
}
return Rectangle(barDim.x, barDim.y + pos, mScrollbarWidth, length);
}
@ -1219,8 +1219,8 @@ namespace gcn
Rectangle barDim = getHorizontalBarDimension();
if (mContent && mContent->getWidth() != 0)
{
length = (barDim.width * getContentDimension().width)
{
length = (barDim.width * getContentDimension().width)
/ mContent->getWidth();
}
else
@ -1237,7 +1237,7 @@ namespace gcn
{
length = barDim.width;
}
if (getHorizontalMaxScroll() != 0)
{
pos = ((barDim.width - length) * getHorizontalScrollAmount())
@ -1254,13 +1254,13 @@ namespace gcn
void ScrollArea::scrollToRectangle(const Rectangle& rectangle)
{
Rectangle contentDim = getContentDimension();
if (rectangle.x + rectangle.width
> getHorizontalScrollAmount() + contentDim.width)
{
setHorizontalScrollAmount(rectangle.x + rectangle.width - contentDim.width);
}
if (rectangle.y + rectangle.height
> getVerticalScrollAmount() + contentDim.height)
{
@ -1271,7 +1271,7 @@ namespace gcn
{
setHorizontalScrollAmount(rectangle.x);
}
if (rectangle.y < getVerticalScrollAmount())
{
setVerticalScrollAmount(rectangle.y);
@ -1279,19 +1279,19 @@ namespace gcn
}
void ScrollArea::mouseWheelUp(int, int)
{
{
if (hasMouse())
{
setVerticalScrollAmount(getVerticalScrollAmount() - getContentDimension().height / 8);
}
}
}
void ScrollArea::mouseWheelDown(int, int)
{
{
if (hasMouse())
{
setVerticalScrollAmount(getVerticalScrollAmount() + getContentDimension().height / 8);
}
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include "guichan/widgets/slider.h"
@ -68,14 +68,14 @@ namespace gcn
mScaleStart = 0;
mScaleEnd = scaleEnd;
setFocusable(true);
setBorderSize(1);
setOrientation(HORIZONTAL);
setValue(0);
setStepLength(scaleEnd / 10);
setMarkerLength(10);
addMouseListener(this);
addKeyListener(this);
}
@ -83,17 +83,17 @@ namespace gcn
Slider::Slider(double scaleStart, double scaleEnd)
{
mMouseDrag = false;
mScaleStart = scaleStart;
mScaleEnd = scaleEnd;
setFocusable(true);
setBorderSize(1);
setOrientation(HORIZONTAL);
setValue(scaleStart);
setStepLength((scaleEnd - scaleStart)/ 10);
setMarkerLength(10);
addMouseListener(this);
addKeyListener(this);
}
@ -127,12 +127,12 @@ namespace gcn
void Slider::draw(gcn::Graphics* graphics)
{
Color shadowColor = getBaseColor() - 0x101010;
int alpha = getBaseColor().a;
int alpha = getBaseColor().a;
shadowColor.a = alpha;
graphics->setColor(shadowColor);
graphics->fillRectangle(gcn::Rectangle(0,0,getWidth(),getHeight()));
drawMarker(graphics);
}
@ -147,7 +147,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -155,11 +155,11 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void Slider::drawMarker(gcn::Graphics* graphics)
{
gcn::Color faceColor = getBaseColor();
@ -168,9 +168,9 @@ namespace gcn
highlightColor = faceColor + 0x303030;
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
graphics->setColor(faceColor);
shadowColor.a = alpha;
graphics->setColor(faceColor);
if (getOrientation() == HORIZONTAL)
{
@ -187,7 +187,7 @@ namespace gcn
{
graphics->setColor(getForegroundColor());
graphics->drawRectangle(Rectangle(v + 2, 2, getMarkerLength() - 4, getHeight() - 4));
}
}
}
else
{
@ -204,10 +204,10 @@ namespace gcn
{
graphics->setColor(getForegroundColor());
graphics->drawRectangle(Rectangle(2, v + 2, getWidth() - 4, getMarkerLength() - 4));
}
}
}
}
void Slider::mousePress(int x, int y, int button)
{
if (button == gcn::MouseInput::LEFT
@ -222,7 +222,7 @@ namespace gcn
{
setValue(markerPositionToValue(getHeight() - y - getMarkerLength() / 2));
}
mMouseDrag = true;
generateAction();
}
@ -231,17 +231,17 @@ namespace gcn
mMouseDrag = false;
}
}
void Slider::mouseRelease(int, int, int)
{
mMouseDrag = false;
}
void Slider::lostFocus()
{
mMouseDrag = false;
}
void Slider::mouseMotion(int x, int y)
{
if (mMouseDrag)
@ -259,7 +259,7 @@ namespace gcn
setDirty(true);
}
}
void Slider::setValue(double value)
{
if (value > getScaleEnd())
@ -276,7 +276,7 @@ namespace gcn
mValue = value;
}
double Slider::getValue() const
{
return mValue;
@ -331,7 +331,7 @@ namespace gcn
void Slider::setOrientation(unsigned int orientation)
{
mOrientation = orientation;
mOrientation = orientation;
}
unsigned int Slider::getOrientation() const
@ -350,12 +350,12 @@ namespace gcn
{
w = getHeight();
}
double pos = v / ((double)w - getMarkerLength());
return (1.0 - pos) * getScaleStart() + pos * getScaleEnd();
}
int Slider::valueToMarkerPosition(double value) const
{
int v;
@ -371,17 +371,17 @@ namespace gcn
int w = (int)((v - getMarkerLength())
* (value - getScaleStart())
/ (getScaleEnd() - getScaleStart()));
if (w < 0)
{
return 0;
}
if (w > v - getMarkerLength())
{
return v - getMarkerLength();
}
return w;
}
@ -398,5 +398,5 @@ namespace gcn
int Slider::getMarkerPosition() const
{
return valueToMarkerPosition(getValue());
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <typeinfo>
@ -74,30 +74,30 @@ namespace gcn
mCaretRow = 0;
mEditable = true;
mOpaque = true;
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
adjustSize();
setBorderSize(1);
setBorderSize(1);
}
TextBox::TextBox(const std::string& text)
{
mCaretColumn = 0;
mCaretRow = 0;
mEditable = true;
mOpaque = true;
setText(text);
setFocusable(true);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
adjustSize();
setBorderSize(1);
setBorderSize(1);
}
void TextBox::setText(const std::string& text)
@ -106,7 +106,7 @@ namespace gcn
mCaretRow = 0;
mTextRows.clear();
std::string::size_type pos, lastPos = 0;
int length;
do
@ -124,27 +124,27 @@ namespace gcn
std::string sub = text.substr(lastPos, length);
mTextRows.push_back(sub);
lastPos = pos + 1;
} while (pos != std::string::npos);
adjustSize();
adjustSize();
}
void TextBox::draw(Graphics* graphics)
{
unsigned int i;
if (mOpaque)
{
graphics->setColor(getBackgroundColor());
{
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
}
if (hasFocus() && isEditable())
{
{
drawCaret(graphics, getFont()->getWidth(mTextRows[mCaretRow].substr(0, mCaretColumn)), mCaretRow * getFont()->getHeight());
}
graphics->setColor(getForegroundColor());
graphics->setFont(getFont());
@ -152,7 +152,7 @@ namespace gcn
{
// Move the text one pixel so we can have a caret before a letter.
graphics->drawText(mTextRows[i], 1, i * getFont()->getHeight());
}
}
}
void TextBox::drawBorder(Graphics* graphics)
@ -167,19 +167,19 @@ namespace gcn
{
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void TextBox::drawCaret(Graphics* graphics, int x, int y)
{
graphics->setColor(getForegroundColor());
graphics->drawLine(x, getFont()->getHeight() + y, x, y);
}
void TextBox::mousePress(int x, int y, int button)
{
{
if (hasMouse() && button == MouseInput::LEFT)
{
mCaretRow = y / getFont()->getHeight();
@ -188,7 +188,7 @@ namespace gcn
{
mCaretRow = mTextRows.size() - 1;
}
mCaretColumn = getFont()->getStringIndexAt(mTextRows[mCaretRow], x);
}
else if (hasMouse() && button == MouseInput::MIDDLE)
@ -201,7 +201,7 @@ namespace gcn
}
}
}
static int FindNext(const std::string &text, int curpos)
{
if (curpos < 0) return 0;
@ -213,7 +213,7 @@ namespace gcn
}
return text.size();
}
bool TextBox::keyPress(const Key& key)
{
bool ret = false;
@ -252,7 +252,7 @@ namespace gcn
{
mCaretRow = 0;
}
mCaretColumn = mTextRows[mCaretRow].size();
}
else
@ -279,13 +279,13 @@ namespace gcn
{
mCaretColumn = 0;
ret = true;
}
}
else if (key.getValue() == Key::K_END)
{
mCaretColumn = mTextRows[mCaretRow].size();
ret = true;
}
}
else if (key.getValue() == Key::K_ENTER && mEditable)
{
@ -370,7 +370,7 @@ namespace gcn
&& mEditable)
{
mTextRows[mCaretRow].insert(mCaretColumn,std::string(" "));
mCaretColumn += 4;
mCaretColumn += 4;
ret = true;
}
@ -391,8 +391,8 @@ namespace gcn
mTextRows[mCaretRow].insert(mCaretColumn,key.toString());
mCaretColumn = UTF8GetNext(mTextRows[mCaretRow], mCaretColumn);
ret = true;
}
}
adjustSize();
scrollToCaret();
return ret;
@ -410,11 +410,11 @@ namespace gcn
width = w;
}
}
setWidth(width + 1);
setHeight(getFont()->getHeight() * mTextRows.size());
}
}
void TextBox::setCaretPosition(unsigned int position)
{
int row;
@ -429,13 +429,13 @@ namespace gcn
}
else
{
position--;
position--;
}
}
// position beyond end of text
mCaretRow = mTextRows.size() - 1;
mCaretColumn = mTextRows[mCaretRow].size();
mCaretColumn = mTextRows[mCaretRow].size();
}
unsigned int TextBox::getCaretPosition() const
@ -447,7 +447,7 @@ namespace gcn
pos += mTextRows[row].size();
}
return pos + mCaretColumn;
return pos + mCaretColumn;
}
void TextBox::setCaretRowColumn(int row, int column)
@ -457,7 +457,7 @@ namespace gcn
}
void TextBox::setCaretRow(int row)
{
{
mCaretRow = row;
if (mCaretRow >= (int)mTextRows.size())
@ -470,12 +470,12 @@ namespace gcn
mCaretRow = 0;
}
setCaretColumn(mCaretColumn);
setCaretColumn(mCaretColumn);
}
unsigned int TextBox::getCaretRow() const
{
return mCaretRow;
return mCaretRow;
}
void TextBox::setCaretColumn(int column)
@ -499,7 +499,7 @@ namespace gcn
{
return mCaretColumn;
}
const std::string& TextBox::getTextRow(int row) const
{
return mTextRows[row];
@ -528,10 +528,10 @@ namespace gcn
{
return std::string("");
}
int i;
std::string text;
for (i = 0; i < (int)mTextRows.size() - 1; ++i)
{
text = text + mTextRows[i] + "\n";
@ -553,8 +553,8 @@ namespace gcn
if (par == NULL)
{
return;
}
}
ScrollArea* scrollArea = dynamic_cast<ScrollArea *>(par);
if (scrollArea != NULL)
{
@ -591,5 +591,5 @@ namespace gcn
void TextBox::setOpaque(bool opaque)
{
mOpaque = opaque;
}
}
}

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/keyinput.h"
@ -76,9 +76,9 @@ namespace gcn
addMouseListener(this);
addKeyListener(this);
adjustHeight();
setBorderSize(1);
setBorderSize(1);
}
TextField::TextField(const std::string& text)
{
mCaretPosition = 0;
@ -89,11 +89,11 @@ namespace gcn
mText = text;
adjustSize();
setBorderSize(1);
setFocusable(true);
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
addKeyListener(this);
}
void TextField::setText(const std::string& text)
@ -102,10 +102,10 @@ namespace gcn
{
mCaretPosition = text.size();
}
mText = text;
mText = text;
}
void TextField::draw(Graphics* graphics)
{
Font *font;
@ -113,12 +113,12 @@ namespace gcn
Color faceColor = getBackgroundColor();
graphics->setColor(faceColor);
graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
if (hasFocus())
{
{
drawCaret(graphics, getFont()->getWidth(mText.substr(0, mCaretPosition)) - mXScroll);
}
graphics->setColor(getForegroundColor());
font = getFont();
graphics->setFont(font);
@ -146,7 +146,7 @@ namespace gcn
graphics->fillRectangle(Rectangle(x + selX, y, selW, font->getHeight()));
}
graphics->drawText(mText, x, y);
graphics->drawText(mText, x, y);
}
void TextField::drawBorder(Graphics* graphics)
@ -160,7 +160,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -168,17 +168,17 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(highlightColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
void TextField::drawCaret(Graphics* graphics, int x)
{
graphics->setColor(getForegroundColor());
graphics->drawLine(x, getHeight() - 2, x, 1);
graphics->drawLine(x, getHeight() - 2, x, 1);
}
void TextField::mousePress(int x, int, int button)
{
if (hasMouse() && button == MouseInput::LEFT)
@ -315,7 +315,7 @@ namespace gcn
}
mCaretPosition = 0;
ret = true;
}
}
else if (key.getValue() == Key::K_END || key.getValue() == 'e' - 'a' + 1) //ctrl-e
{
@ -328,7 +328,7 @@ namespace gcn
mCaretPosition = mText.size();
ret = true;
}
}
else if (key.getValue() == 'u' - 'a' + 1) // ctrl-u
{
@ -384,12 +384,12 @@ namespace gcn
setWidth(getFont()->getWidth(mText) + 4);
adjustHeight();
fixScroll();
fixScroll();
}
void TextField::adjustHeight()
{
setHeight(getFont()->getHeight() + 2);
setHeight(getFont()->getHeight() + 2);
}
void TextField::fixScroll()
@ -405,7 +405,7 @@ namespace gcn
else if (caretX - mXScroll < getFont()->getWidth(" "))
{
mXScroll = caretX - getFont()->getWidth(" ");
if (mXScroll < 0)
{
mXScroll = 0;
@ -421,16 +421,16 @@ namespace gcn
mCaretPosition = mText.size();
}
else
{
{
mCaretPosition = position;
}
fixScroll();
fixScroll();
}
unsigned int TextField::getCaretPosition() const
{
return mCaretPosition;
return mCaretPosition;
}
void TextField::getTextSelectionPositions(unsigned int* first, unsigned int* len)
@ -449,9 +449,9 @@ namespace gcn
const std::string& TextField::getText() const
{
return mText;
return mText;
}
void TextField::fontChanged()
{
fixScroll();

View file

@ -1,10 +1,10 @@
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005 darkbits Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
@ -53,7 +53,7 @@
*/
/*
* For comments regarding functions please see the header file.
* For comments regarding functions please see the header file.
*/
#include <assert.h>
#include "guichan/widgets/window.h"
@ -79,7 +79,7 @@ namespace gcn
{
mContent = NULL;
mMouseDrag = false;
setCaption(caption);
setCaption(caption);
setBorderSize(1);
setPadding(2);
setTitleBarHeight(16);
@ -92,14 +92,14 @@ namespace gcn
Window::Window(Widget* content, const std::string& caption)
{
mContent = NULL;
mMouseDrag = false;
mMouseDrag = false;
setContent(content);
setCaption(caption);
setBorderSize(1);
setPadding(2);
setTitleBarHeight(16);
setAlignment(Graphics::CENTER);
addMouseListener(this);
addMouseListener(this);
setMovable(true);
setOpaque(true);
}
@ -108,7 +108,7 @@ namespace gcn
{
setContent(NULL);
}
void Window::setPadding(unsigned int padding)
{
mPadding = padding;
@ -143,7 +143,7 @@ namespace gcn
getContent()->_setParent(NULL);
getContent()->_setFocusHandler(NULL);
}
if (widget != NULL)
{
widget->_setParent(this);
@ -167,7 +167,7 @@ namespace gcn
const std::string& Window::getCaption() const
{
return mCaption;
return mCaption;
}
void Window::setAlignment(unsigned int alignment)
@ -208,13 +208,13 @@ namespace gcn
graphics->fillRectangle(Rectangle(d.x - 1,
d.y + d.height + 1,
d.width + 2,
getHeight() - d.height - d.y - 1));
getHeight() - d.height - d.y - 1));
if (isOpaque())
{
{
graphics->fillRectangle(d);
}
// Construct a rectangle one pixel bigger than the content
d.x -= 1;
d.y -= 1;
@ -234,7 +234,7 @@ namespace gcn
d.y + 1,
d.x,
d.y + d.height - 1);
graphics->setColor(highlightColor);
// Right line
graphics->drawLine(d.x + d.width - 1,
@ -248,7 +248,7 @@ namespace gcn
d.y + d.height - 1);
drawContent(graphics);
int textX;
int textY;
textY = ((int)getTitleBarHeight() - getFont()->getHeight()) / 2;
@ -284,7 +284,7 @@ namespace gcn
highlightColor.a = alpha;
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
unsigned int i;
for (i = 0; i < getBorderSize(); ++i)
{
@ -292,8 +292,8 @@ namespace gcn
graphics->drawLine(i,i, width - i, i);
graphics->drawLine(i,i + 1, i, height - i - 1);
graphics->setColor(shadowColor);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
graphics->drawLine(width - i,i + 1, width - i, height - i);
graphics->drawLine(i,height - i, width - i - 1, height - i);
}
}
@ -309,14 +309,14 @@ namespace gcn
graphics->popClipArea();
}
}
void Window::mousePress(int x, int y, int button)
{
{
if (getParent() != NULL)
{
getParent()->moveToTop(this);
}
if (isMovable() && hasMouse()
&& y < (int)(getTitleBarHeight() + getPadding()) && button == 1)
{
@ -325,7 +325,7 @@ namespace gcn
mMouseYOffset = y;
}
}
void Window::mouseRelease(int, int, int button)
{
if (button == 1)
@ -343,7 +343,7 @@ namespace gcn
setDirty(true);
}
}
void Window::moveToTop(Widget* widget)
{
if (widget != getContent())
@ -352,16 +352,16 @@ namespace gcn
assert(!"Widget is not content of window.");
}
}
void Window::moveToBottom(Widget* widget)
{
if (widget != getContent())
{
//throw GCN_EXCEPTION("Widget is not content of window");
assert(!"Widget is not content of window.");
//throw GCN_EXCEPTION("Widget is not content of window");
assert(!"Widget is not content of window.");
}
}
void Window::getDrawSize(int& width, int& height, Widget* widget)
{
if (widget != getContent())
@ -385,7 +385,7 @@ namespace gcn
Rectangle d = getContentDimension();
mContent->setPosition(d.x, d.y);
}
Rectangle Window::getContentDimension()
{
return Rectangle(getPadding(),
@ -407,7 +407,7 @@ namespace gcn
void Window::resizeToContent()
{
if (getContent() != NULL)
{
{
setSize(getContent()->getWidth() + 2*getPadding(),
getContent()->getHeight() + getPadding()
+ getTitleBarHeight());
@ -417,7 +417,7 @@ namespace gcn
void Window::_mouseInputMessage(const MouseInput &mouseInput)
{
BasicContainer::_mouseInputMessage(mouseInput);
if (getContent() != NULL)
{
if (getContentDimension().isPointInRect(mouseInput.x, mouseInput.y) &&
@ -425,9 +425,9 @@ namespace gcn
{
if (!getContent()->hasMouse())
{
getContent()->_mouseInMessage();
getContent()->_mouseInMessage();
}
MouseInput mi = mouseInput;
mi.x -= getContent()->getX();
mi.y -= getContent()->getY();
@ -439,15 +439,15 @@ namespace gcn
}
}
}
void Window::_mouseOutMessage()
{
BasicContainer::_mouseOutMessage();
if (getContent() != NULL && getContent()->hasMouse())
{
getContent()->_mouseOutMessage();
}
}
}
void Window::_setFocusHandler(FocusHandler *focusHandler)
@ -456,7 +456,7 @@ namespace gcn
{
getContent()->_setFocusHandler(focusHandler);
}
BasicContainer::_setFocusHandler(focusHandler);
}
@ -467,7 +467,7 @@ namespace gcn
bool Window::isOpaque()
{
return mOpaque;
return mOpaque;
}
void Window::logic()

View file

@ -80,7 +80,7 @@
#ifdef __GNUC__
#ifdef USE_WIN32
#define makedir(dir, permissions) mkdir(dir)
#else
#else
#define makedir(dir, permissions) mkdir(dir, permissions)
#endif
#endif

View file

@ -1124,10 +1124,10 @@ public:
DataKey k;
k.key = key;
k.keylen = strlen(key);
const DataKey* p = std::lower_bound(buildin, buildin + SIZE,
k, DataKey::key_pred);
if ((p != buildin + SIZE) && p->keylen == k.keylen &&
0 == strcmp(p->key, key)) {
const DataKey* p = std::lower_bound(buildin, buildin + SIZE,
k, DataKey::key_pred);
if ((p != buildin + SIZE) && p->keylen == k.keylen &&
0 == strcmp(p->key, key)) {
return p->offset;
} else {
std::map<std::string, int>::iterator

View file

@ -31,96 +31,96 @@
#ifndef __VEC2I_H__
#define __VEC2I_H__
//@{
class Vec2i
{
public:
short int x;
short int y;
};
inline bool operator == (const Vec2i &lhs, const Vec2i & rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y;
}
inline bool operator != (const Vec2i &lhs, const Vec2i & rhs)
{
return !(lhs == rhs);
}
inline const Vec2i& operator += (Vec2i &lhs, const Vec2i& rhs)
{
lhs.x += rhs.x;
lhs.y += rhs.y;
return lhs;
}
inline const Vec2i& operator -= (Vec2i &lhs, const Vec2i& rhs)
{
lhs.x -= rhs.x;
lhs.y -= rhs.y;
return lhs;
}
inline const Vec2i& operator *= (Vec2i &lhs, int rhs)
{
lhs.x *= rhs;
lhs.y *= rhs;
return lhs;
}
inline const Vec2i& operator /= (Vec2i &lhs, int rhs)
{
lhs.x /= rhs;
lhs.y /= rhs;
return lhs;
}
inline Vec2i operator + (const Vec2i &lhs, const Vec2i& rhs)
{
Vec2i res(lhs);
res += rhs;
return res;
}
inline Vec2i operator - (const Vec2i &lhs, const Vec2i& rhs)
{
Vec2i res(lhs);
res -= rhs;
return res;
}
inline Vec2i operator * (const Vec2i &lhs, int rhs)
{
Vec2i res(lhs);
res *= rhs;
return res;
}
inline Vec2i operator * (int lhs, const Vec2i &rhs)
{
Vec2i res(rhs);
res *= lhs;
return res;
}
inline Vec2i operator / (const Vec2i &lhs, int rhs)
{
Vec2i res(lhs);
res /= rhs;
return res;
}
//@{
class Vec2i
{
public:
short int x;
short int y;
};
inline bool operator == (const Vec2i &lhs, const Vec2i & rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y;
}
inline bool operator != (const Vec2i &lhs, const Vec2i & rhs)
{
return !(lhs == rhs);
}
inline const Vec2i& operator += (Vec2i &lhs, const Vec2i& rhs)
{
lhs.x += rhs.x;
lhs.y += rhs.y;
return lhs;
}
inline const Vec2i& operator -= (Vec2i &lhs, const Vec2i& rhs)
{
lhs.x -= rhs.x;
lhs.y -= rhs.y;
return lhs;
}
inline const Vec2i& operator *= (Vec2i &lhs, int rhs)
{
lhs.x *= rhs;
lhs.y *= rhs;
return lhs;
}
inline const Vec2i& operator /= (Vec2i &lhs, int rhs)
{
lhs.x /= rhs;
lhs.y /= rhs;
return lhs;
}
inline Vec2i operator + (const Vec2i &lhs, const Vec2i& rhs)
{
Vec2i res(lhs);
res += rhs;
return res;
}
inline Vec2i operator - (const Vec2i &lhs, const Vec2i& rhs)
{
Vec2i res(lhs);
res -= rhs;
return res;
}
inline Vec2i operator * (const Vec2i &lhs, int rhs)
{
Vec2i res(lhs);
res *= rhs;
return res;
}
inline Vec2i operator * (int lhs, const Vec2i &rhs)
{
Vec2i res(rhs);
res *= lhs;
return res;
}
inline Vec2i operator / (const Vec2i &lhs, int rhs)
{
Vec2i res(lhs);
res /= rhs;
return res;
}
//@}
#endif // !__VEC2I_H__
#endif // !__VEC2I_H__

View file

@ -68,7 +68,7 @@ void CMap::Save(CFile *file) const
file->printf("--- MODULE: map $Id$\n");
file->printf("LoadTileModels(\"%s\")\n\n", this->TileModelsFileName);
file->printf("StratagusMap(\n");
file->printf(" \"version\", \"" StratagusFormatString "\",\n",

View file

@ -306,7 +306,7 @@ static int DefineTilesetParseSolid(lua_State *l, CTileset *tileset, int index)
int basic_name;
int j = 0;
int pud;
ExtendTilesetTables(tileset, index, 16);
if (!lua_istable(l, -1)) {
@ -341,22 +341,22 @@ static int DefineTilesetParseSolid(lua_State *l, CTileset *tileset, int index)
tileset->FlagsTable[index + j] = tile_flag;
continue;
}
pud = LuaToNumber(l, -1);
lua_pop(l, 1);
// ugly hack for sc tilesets, remove when fixed
if (j > 15) {
ExtendTilesetTables(tileset, index, j);
}
tileset->Table[index + j] = pud;
tileset->FlagsTable[index + j] = f;
tileset->Tiles[index + j].BaseTerrain = basic_name;
tileset->Tiles[index + j].MixTerrain = 0;
}
lua_pop(l, 1);
i = j;
while (i < 16) {
tileset->Table[index + i] = 0;
@ -390,7 +390,7 @@ static int DefineTilesetParseMixed(lua_State *l, CTileset *tileset, int index)
int j;
int args;
int pud;
new_index = index + 256;
ExtendTilesetTables(tileset, index, 256);

View file

@ -220,7 +220,7 @@ unsigned char *CInitMessage::Serialize() const
memcpy(p, x, CNetworkHost::Size());
p += CNetworkHost::Size();
delete[] x;
}
}
break;
case ICMMap:
memcpy(p, this->u.MapPath, sizeof(this->u.MapPath));
@ -470,7 +470,7 @@ void NetworkInitServerConnect(int openslots)
// preset the server (initially always slot 0)
memcpy(Hosts[0].PlyName, LocalPlayerName.c_str(), sizeof(Hosts[0].PlyName) - 1);
ServerSetupState.Clear();
LocalSetupState.Clear();
for (i = openslots; i < PlayerMax - 1; ++i) {
@ -1260,7 +1260,7 @@ static void ClientParseConnecting(const CInitMessage *msg)
**
** @return true if the map name looks safe.
*/
static bool IsSafeMapName(const char *mapname)
static bool IsSafeMapName(const char *mapname)
{
char buf[256];
const char *ch;
@ -1274,7 +1274,7 @@ static bool IsSafeMapName(const char *mapname)
if (strstr(buf, "//")) {
return false;
}
if (buf[0] == '\0') {
if (buf[0] == '\0') {
return false;
}
ch = buf;

View file

@ -249,14 +249,14 @@ int OggInit(CFile *f, OggData *data)
#endif
// are we in the vorbis page ?
while (num_vorbis && num_vorbis < 3 &&
while (num_vorbis && num_vorbis < 3 &&
(ret = ogg_stream_packetout(&data->astream, &packet))) {
if (ret < 0) {
return -1;
}
if (vorbis_synthesis_headerin(&data->vinfo, &data->vcomment, &packet)) {
return -1;
}
++num_vorbis;
}

View file

@ -67,7 +67,7 @@ bool WINAPI_AttachConsole() {
int osIn = _open_osfhandle((intptr_t) hIn, O_TEXT);
int osOut = _open_osfhandle((intptr_t) hOut, O_TEXT);
int osErr = _open_osfhandle((intptr_t) hErr, O_TEXT);
if ( osIn == -1 || osOut == -1 || osErr == -1 )
return false;

View file

@ -303,9 +303,9 @@ void GroupHelpMe(CUnit *attacker, CUnit &defender)
// can attack our attacker then ask for help
if (gunit.IsAgressive() && (gunit.IsIdle() ||
!(gunit.CurrentAction() == UnitActionAttack &&
gunit.CurrentOrder()->HasGoal() &&
gunit.CurrentOrder()->GetGoal()->IsAgressive()))
&& CanTarget(gunit.Type, attacker->Type)) {
gunit.CurrentOrder()->HasGoal() &&
gunit.CurrentOrder()->GetGoal()->IsAgressive()))
&& CanTarget(gunit.Type, attacker->Type)) {
if (gunit.SavedOrder.Action == UnitActionStill) {
// FIXME: should rewrite command handling

View file

@ -262,7 +262,7 @@ static void LuaLoadBuffer(const std::string &file, std::string &buffer)
ExitFatal(-1);
}
location = 0;
for (;;) {
for () {
read = fp.read(&buf[location], size - location);
if (read != size - location) {
location += read;

View file

@ -348,7 +348,7 @@ static int CclPlayer(lua_State *l)
CclGetUnitFromRef(l);
player->AutoAttackTargets.Insert(CclGetUnitFromRef(l));
lua_pop(l, 1);
}
}
} else {
LuaError(l, "Unsupported tag: %s" _C_ value);
}
@ -761,7 +761,7 @@ static int CclGetPlayerData(lua_State *l)
} else if (!strcmp(data, "Resources")) {
LuaCheckArgs(l, 3);
const std::string res = LuaToString(l, 3);;
const std::string res = LuaToString(l, 3)
unsigned int i;
for (i = 0; i < MaxCosts; ++i) {

View file

@ -847,7 +847,7 @@ int main(int argc, char **argv)
//
// Parse commandline
//
for (;;) {
for () {
#ifdef USE_MAEMO
switch (getopt(argc, argv, "c:d:ef:hln:I:P:s:t:v:wD:N:E:S:U:OL:o?")) {
#else

View file

@ -29,18 +29,18 @@ TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def)
TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def)
{
/* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */
if (lua_gettop(L)<abs(narg)) {
return def;
};
if (lua_islightuserdata(L, narg)) {
return lua_touserdata(L,narg);
};
return tolua_tousertype(L, narg, def);
}

View file

@ -96,7 +96,7 @@ void DrawMenuButton(ButtonStyle *style, unsigned flags, int x, int y,
//
if (!text.empty()) {
std::string oldnc;
std::string oldrc;
std::string oldrc;
GetDefaultTextColors(oldnc, oldrc);
CLabel label(style->Font,
(!p->TextNormalColor.empty() ? p->TextNormalColor :

View file

@ -549,7 +549,7 @@ static ConditionPanel *ParseConditionPanel(lua_State *l)
condition->BoolFlags = new char[new_bool_size];
memset(condition->BoolFlags, 0, new_bool_size * sizeof(char));
}
condition->BoolFlags[index] = Ccl2Condition(l, LuaToString(l, -1));
condition->BoolFlags[index] = Ccl2Condition(l, LuaToString(l, -1));
continue;
}
index = UnitTypeVar.VariableNameLookup[key];
@ -683,7 +683,7 @@ static CContentType *CclParseContent(lua_State *l)
contentformattedtext2->Component1 = Str2EnumVariable(l, LuaToString(l, -1));
} else if (!strcmp(key, "Variable2")) {
const char *const name = LuaToString(l, -1);
contentformattedtext2->Index2 = UnitTypeVar.VariableNameLookup[name];
contentformattedtext2->Index2 = UnitTypeVar.VariableNameLookup[name];
if (contentformattedtext2->Index2 == -1) {
LuaError(l, "unknown variable '%s'" _C_ LuaToString(l, -1));
}
@ -715,7 +715,7 @@ static CContentType *CclParseContent(lua_State *l)
key = LuaToString(l, -2);
if (!strcmp(key, "Variable")) {
const char *const name = LuaToString(l, -1);
contentlifebar->Index = UnitTypeVar.VariableNameLookup[name];
contentlifebar->Index = UnitTypeVar.VariableNameLookup[name];
if (contentlifebar->Index == -1) {
LuaError(l, "unknown variable '%s'" _C_ name);
}
@ -745,7 +745,7 @@ static CContentType *CclParseContent(lua_State *l)
key = LuaToString(l, -2);
if (!strcmp(key, "Variable")) {
const char *const name = LuaToString(l, -1);
contenttypecompletebar->Index = UnitTypeVar.VariableNameLookup[name];
contenttypecompletebar->Index = UnitTypeVar.VariableNameLookup[name];
if (contenttypecompletebar->Index == -1) {
LuaError(l, "unknown variable '%s'" _C_ name);
}

Some files were not shown because too many files have changed in this diff Show more