75 lines
2.2 KiB
C
Raw Normal View History

2013-11-22 22:50:14 +09:00
/*
Copyright (c) 2013 yvt
2013-11-22 22:50:14 +09:00
This file is part of OpenSpades.
2013-11-22 22:50:14 +09:00
OpenSpades is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
2013-11-22 22:50:14 +09:00
OpenSpades is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2013-11-22 22:50:14 +09:00
You should have received a copy of the GNU General Public License
along with OpenSpades. If not, see <http://www.gnu.org/licenses/>.
2013-11-22 22:50:14 +09:00
*/
#pragma once
2013-12-09 17:36:05 +09:00
#include <Core/Math.h>
#include <Core/RefCountedObject.h>
2013-11-22 22:50:14 +09:00
2019-07-14 18:29:50 +09:00
#include "ConsoleCommandCandidate.h"
2013-11-22 22:50:14 +09:00
namespace spades {
namespace gui {
2019-07-14 14:31:51 +09:00
class ConsoleCommand;
class View : public RefCountedObject {
2013-11-22 22:50:14 +09:00
protected:
virtual ~View() {}
2013-11-22 22:50:14 +09:00
public:
View() {}
2013-11-22 22:50:14 +09:00
virtual void MouseEvent(float x, float y) {}
virtual void KeyEvent(const std::string &, bool down) {}
virtual void TextInputEvent(const std::string &) {}
virtual void TextEditingEvent(const std::string &, int start, int len) {}
2013-12-09 17:36:05 +09:00
virtual bool AcceptsTextInput() { return false; }
virtual AABB2 GetTextInputRect() { return AABB2(); }
2014-02-01 21:55:30 +09:00
virtual bool NeedsAbsoluteMouseCoordinate() { return false; }
2013-12-09 17:36:05 +09:00
virtual void WheelEvent(float x, float y) {}
/** Called for every frame. */
2013-11-22 22:50:14 +09:00
virtual void RunFrame(float dt) {}
/** Called for every frame after `RunFrame`. */
virtual void RunFrameLate(float dt) {}
2013-11-22 22:50:14 +09:00
virtual void Closing() {}
2013-11-22 22:50:14 +09:00
virtual bool WantsToBeClosed() { return false; }
2019-07-14 14:31:51 +09:00
/**
* Execute a console command.
*
* @return `true` if the command was handled.
*/
virtual bool ExecCommand(const Handle<ConsoleCommand> &) { return false; }
2019-07-14 18:29:50 +09:00
/**
* Produce a sequence of candidates for command name autocompletion.
2019-07-14 18:29:50 +09:00
*
* `name` is an incomplete command name. This method produces
* a sequence of candidates starting with `name`.
*/
virtual Handle<ConsoleCommandCandidateIterator>
AutocompleteCommandName(const std::string &name);
2013-11-22 22:50:14 +09:00
};
2019-07-14 14:31:51 +09:00
} // namespace gui
} // namespace spades