00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#include <SDL.h>
00024
#include "guitypedefs.h"
00025
#include "guicolors.h"
00026
#ifdef _WIN32
00027
#pragma warning(push)
00028
00029
#include <yvals.h>
00030
00031
#pragma warning(disable: 4251)
00032
#pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information
00033
00034
00035
00036
00037
00038
#include <sge.h>
00039
00040
#pragma warning(pop)
00041
#else
00042
#include <sge.h>
00043
#endif
00044
00045
#include "SDL_prim.h"
00046
00047
#include "TTFont.h"
00048
#include "SDLControl.h"
00049
#include "Surface.h"
00050
#include "Static.h"
00051
#include "Button.h"
00052
#include "HotButton.h"
00053
00054
00055
namespace gui
00056 {
00057
00058
00059 HotButton::HotButton(
Surface *s,
coord_t x,coord_t y,
buttonstyle_t style,
SurfaceHelper *sh)
00060 :
Button(s,x,y,style,sh)
00061 {
00062 SetClickable(
true);
00063 }
00064
00065
00066 HotButton::~HotButton()
00067 {
00068 }
00069
00070
00071 void HotButton::OnMouseIn()
00072 {
00073
Surface *pclParent =
GetParent();
00074
if (
IsClickable())
00075 {
00076 SetInverted(
true);
00077
while (pclParent)
00078 {
00079
if (pclParent ->
UseTemporaryScreen())
00080 {
00081 pclParent ->
DrawTemporaryScreen();
00082
break;
00083 }
00084 pclParent = pclParent ->
GetParent();
00085 }
00086
InvalidateEv();
00087 }
00088 }
00089
00090
00091 void HotButton::OnMouseOut()
00092 {
00093
Surface *pclParent =
GetParent();
00094
if (
IsClickable())
00095 {
00096 SetInverted(
false);
00097
while (pclParent)
00098 {
00099
if (pclParent ->
UseTemporaryScreen())
00100 {
00101 pclParent ->
DrawTemporaryScreen();
00102
break;
00103 }
00104 pclParent = pclParent ->
GetParent();
00105 }
00106
InvalidateEv();
00107 }
00108 }
00109
00110
00111 void HotButton::OnClick(coord_t x,coord_t y)
00112 {
00113
00114
OnButton();
00115 SetTimer(250);
00116 }
00117
00118
00119 void HotButton::OnTimer(
long id)
00120 {
00121
00122
if (
IsInverted())
00123 {
00124
OnButton();
00125 SetTimer(90);
00126 }
00127 }
00128
00129
00130 }
00131
00132