Remove old tip skeleton code.

The code is obsolete by the recent tooltip and helptip changes.
This commit is contained in:
Mark de Wever 2011-02-12 21:36:45 +00:00
parent 19490f0a31
commit d6e33c7c58
2 changed files with 0 additions and 190 deletions

View file

@ -725,114 +725,6 @@ void tdistributor::keyboard_remove_from_chain(twidget* widget)
keyboard_focus_chain_.erase(itor);
}
}
#if 0
void tdistributor::show_tooltip(const t_string& message, const unsigned timeout)
{
DBG_GUI_E << "Event: show tooltip.\n";
assert(!tooltip_);
if(help_popup_) {
remove_help_popup();
}
tooltip_ = mouse_focus_;
do_show_tooltip(tpoint(mouse_x_, mouse_y_), message);
if(timeout) {
SDL_AddTimer(timeout, popup_callback, 0);
}
}
void tdistributor::remove_tooltip()
{
if(!tooltip_) {
return;
}
tooltip_ = 0;
do_remove_tooltip();
}
void tdistributor::show_help_popup(const t_string& message, const unsigned timeout)
{
DBG_GUI_E << "Event: show help popup.\n";
if(help_popup_) {
DBG_GUI_E << "Help is already there, bailing out.\n";
return;
}
if(tooltip_) {
remove_tooltip();
}
// Kill hover events FIXME not documented.
had_hover_ = true;
hover_pending_ = false;
help_popup_ = mouse_focus_;
do_show_help_popup(tpoint(mouse_x_, mouse_y_), message);
if(timeout) {
SDL_AddTimer(timeout, popup_callback, 0);
}
}
void tdistributor::remove_help_popup()
{
if(!help_popup_) {
return;
}
help_popup_ = 0;
do_remove_help_popup();
}
void tdistributor::set_hover(const bool test_on_widget)
{
// Only one hover event.
if(had_hover_) {
return;
}
// Don't want a hover.
if(!mouse_focus_ || !mouse_focus_->wants_mouse_hover()) {
return;
}
// Have an hover and still in the bounding rect.
if(hover_pending_ && point_in_rect(mouse_x_, mouse_y_, hover_box_)) {
return;
}
// Mouse down, no hovering
if(left_.is_down_ || middle_.is_down_ || right_.is_down_) {
return;
}
if(test_on_widget) {
// FIXME implement
}
static unsigned hover_id = 0;
hover_pending_ = true;
// FIXME hover dimentions should be from the settings
// also should check the entire box is on the widget???
hover_box_ = ::create_rect(mouse_x_ - 5, mouse_y_ - 5, 10, 10);
unsigned *hover = new unsigned;
*hover = hover_id;
hover_id_ = hover_id++;
SDL_AddTimer(settings::popup_show_delay, hover_callback, hover);
}
#endif
void tdistributor::signal_handler_sdl_key_down(const SDLKey key
, const SDLMod modifier

View file

@ -37,19 +37,12 @@
*
* tdistributor is the main class to be used in the user code. This class
* contains the handling of the keyboard as well.
*
* @todo Finish hovering and tooltips.
*
* The code for these functions is available but commented out so that can be
* used as example for how to implement it.
*/
#include "gui/auxiliary/event/dispatcher.hpp"
#include "gui/widgets/event_executor.hpp"
#include "gui/widgets/helper.hpp"
class t_string;
namespace gui2{
class twidget;
@ -288,38 +281,6 @@ public:
*/
void keyboard_remove_from_chain(twidget* widget);
/**
* Shows a tooltip.
*
* A tooltip is a small shortly visible item which is meant to show the user
* extra information. It shows after a short time hovering over a widget and
* automatically disappears again after a while. Only one tooltip or help
* message can be active at a time.
*
* @param message The message to show.
* @param timeout The time the tooltip is shown, 0 means
* forever.
*/
void show_tooltip(const t_string& message, const unsigned timeout);
/** Removes the currently shown tooltip. */
void remove_tooltip();
/**
* Shows a help message.
*
* A help message is like a tooltip, but in general contains more info and
* the user needs to trigger it (most of the time with the F1 button).
*
* @param message The message to show.
* @param timeout The time the help message is shown, 0 means
* forever.
*/
void show_help_popup(const t_string& message, const unsigned timeout);
/** Removes the currently show tooltip. */
void remove_help_popup();
private:
bool hover_pending_; /**< Is there a hover event pending? */
@ -354,49 +315,6 @@ private:
*/
std::vector<twidget*> keyboard_focus_chain_;
#if 0
/**
* Raises a hover request.
*
* @param test_on_widget Do we need to test whether we're on a widget.
*/
void set_hover(const bool test_on_widget = false);
/**
* The function to do the real job of showing the tooltip.
*
* @param location The location in the window where to show the
* tooltip.
* @param tooltip The message to show.
*/
virtual void do_show_tooltip(
const tpoint& location, const t_string& tooltip) = 0;
/** Function to do the real removal of the tooltip. */
virtual void do_remove_tooltip() = 0;
/**
* The function to do the real job of showing the help popup.
*
* @param location The location in the window where to show the
* help popup.
* @param help_popup The message to show.
*/
virtual void do_show_help_popup(
const tpoint& location, const t_string& help_popup) = 0;
/** Function to do the real removal of the help popup. */
virtual void do_remove_help_popup() = 0;
/**
* Handler for the click dismiss functionallity.
*
* @returns True if the click dismiss action is performed,
* false otherwise.
*/
virtual bool click_dismiss() = 0;
#endif
/**
* Set of functions that handle certain events and sends them to the proper
* widget. These functions are called by the SDL event handling functions.