Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BaseInterface::Room::Link Class Reference

#include <base.h>

Inheritance diagram for BaseInterface::Room::Link:
BaseInterface::Room::Comp BaseInterface::Room::Eject BaseInterface::Room::Goto BaseInterface::Room::Launch BaseInterface::Room::Python BaseInterface::Room::Talk

Public Types

enum  {
  ClickEvent =(1<<0), DownEvent =(1<<1), UpEvent =(1<<2), MoveEvent =(1<<3),
  EnterEvent =(1<<4), LeaveEvent =(1<<5)
}
 

Public Member Functions

virtual void Click (::BaseInterface *base, float x, float y, int button, int state)
 
virtual void MouseMove (::BaseInterface *base, float x, float y, int buttonmask)
 
virtual void MouseEnter (::BaseInterface *base, float x, float y, int buttonmask)
 
virtual void MouseLeave (::BaseInterface *base, float x, float y, int buttonmask)
 
void setEventMask (unsigned int mask)
 
 Link (const std::string &ind, const std::string &pfile)
 
virtual ~Link ()
 
virtual void Relink (const std::string &pfile)
 

Public Attributes

std::string pythonfile
 
float x
 
float y
 
float wid
 
float hei
 
float alpha
 
std::string text
 
const std::string index
 
unsigned int eventMask
 
int clickbtn
 

Detailed Description

Definition at line 34 of file base.h.

Member Enumeration Documentation

anonymous enum
Enumerator
ClickEvent 
DownEvent 
UpEvent 
MoveEvent 
EnterEvent 
LeaveEvent 

Definition at line 37 of file base.h.

38  {
39  ClickEvent=(1<<0),
40  DownEvent =(1<<1),
41  UpEvent =(1<<2),
42  MoveEvent =(1<<3),
43  EnterEvent=(1<<4),
44  LeaveEvent=(1<<5)
45  };

Constructor & Destructor Documentation

BaseInterface::Room::Link::Link ( const std::string &  ind,
const std::string &  pfile 
)
inlineexplicit

Definition at line 64 of file base.h.

References f.

64  : pythonfile( pfile )
65  , alpha( 1.0f )
66  , index( ind )
68  , clickbtn( -1 ) {}
virtual BaseInterface::Room::Link::~Link ( )
inlinevirtual

Definition at line 69 of file base.h.

69 {}

Member Function Documentation

void BaseInterface::Room::Link::Click ( ::BaseInterface base,
float  x,
float  y,
int  button,
int  state 
)
virtual

Reimplemented in BaseInterface::Room::Talk, BaseInterface::Room::Eject, BaseInterface::Room::Launch, BaseInterface::Room::Comp, and BaseInterface::Room::Goto.

Definition at line 1329 of file base_interface.cpp.

References getMouseButtonMask(), RunPython(), BaseUtil::SetMouseEventData(), WS_MOUSE_DOWN, and WS_MOUSE_UP.

Referenced by BaseInterface::Room::Goto::Click(), BaseInterface::Room::Comp::Click(), BaseInterface::Room::Launch::Click(), BaseInterface::Room::Eject::Click(), BaseInterface::Room::Talk::Click(), and BaseInterface::Room::Click().

1330 {
1331  unsigned int buttonmask = getMouseButtonMask();
1332  if (state == WS_MOUSE_UP) {
1333  if (eventMask&UpEvent) {
1334  static std::string evtype( "up" );
1335  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1336  RunPython( this->pythonfile.c_str() );
1337  }
1338  }
1339  if (state == WS_MOUSE_UP) {
1340  //For now, the same. Eventually, we'll want click & double-click
1341  if (eventMask&ClickEvent) {
1342  static std::string evtype( "click" );
1343  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1344  RunPython( this->pythonfile.c_str() );
1345  }
1346  }
1347  if (state == WS_MOUSE_DOWN) {
1348  if (eventMask&DownEvent) {
1349  static std::string evtype( "down" );
1350  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1351  RunPython( this->pythonfile.c_str() );
1352  }
1353  }
1354 }
void BaseInterface::Room::Link::MouseEnter ( ::BaseInterface base,
float  x,
float  y,
int  buttonmask 
)
virtual

Definition at line 1369 of file base_interface.cpp.

References RunPython(), and BaseUtil::SetMouseEventData().

Referenced by BaseInterface::MouseOver().

1370 {
1371  if (eventMask&EnterEvent) {
1372  static std::string evtype( "enter" );
1373  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1374  RunPython( this->pythonfile.c_str() );
1375  }
1376 }
void BaseInterface::Room::Link::MouseLeave ( ::BaseInterface base,
float  x,
float  y,
int  buttonmask 
)
virtual

Definition at line 1378 of file base_interface.cpp.

References RunPython(), and BaseUtil::SetMouseEventData().

Referenced by BaseInterface::MouseOver().

1379 {
1380  if (eventMask&LeaveEvent) {
1381  static std::string evtype( "leave" );
1382  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1383  RunPython( this->pythonfile.c_str() );
1384  }
1385  clickbtn = -1;
1386 }
void BaseInterface::Room::Link::MouseMove ( ::BaseInterface base,
float  x,
float  y,
int  buttonmask 
)
virtual

Definition at line 1356 of file base_interface.cpp.

References RunPython(), and BaseUtil::SetMouseEventData().

Referenced by BaseInterface::MouseOver().

1357 {
1358  //Compiling Python code each mouse movement == Bad idea!!!
1359  //If this support is needed we will need to use Python-C++ inheritance.
1360  //Like the Execute() method of AI and Mission classes.
1361  //Even better idea: Rewrite the entire BaseInterface python interface.
1362  if (eventMask&MoveEvent) {
1363  static std::string evtype( "move" );
1364  BaseUtil::SetMouseEventData( evtype, x, y, buttonmask );
1365  RunPython( this->pythonfile.c_str() );
1366  }
1367 }
void BaseInterface::Room::Link::Relink ( const std::string &  pfile)
virtual

Definition at line 1388 of file base_interface.cpp.

1389 {
1390  pythonfile = pfile;
1391 }
void BaseInterface::Room::Link::setEventMask ( unsigned int  mask)
inline

Definition at line 59 of file base.h.

References eventMask.

60  {
61  eventMask = mask;
62  }

Member Data Documentation

float BaseInterface::Room::Link::alpha

Definition at line 48 of file base.h.

int BaseInterface::Room::Link::clickbtn

Definition at line 52 of file base.h.

unsigned int BaseInterface::Room::Link::eventMask

Definition at line 51 of file base.h.

Referenced by setEventMask().

float BaseInterface::Room::Link::hei

Definition at line 48 of file base.h.

Referenced by BaseUtil::BaseLink(), and BaseInterface::Room::Click().

const std::string BaseInterface::Room::Link::index

Definition at line 50 of file base.h.

std::string BaseInterface::Room::Link::pythonfile

Definition at line 47 of file base.h.

Referenced by BaseInterface::MouseOver().

std::string BaseInterface::Room::Link::text

Definition at line 49 of file base.h.

Referenced by BaseUtil::BaseLink(), and BaseInterface::MouseOver().

float BaseInterface::Room::Link::wid

Definition at line 48 of file base.h.

Referenced by BaseUtil::BaseLink(), and BaseInterface::Room::Click().

float BaseInterface::Room::Link::x

Definition at line 48 of file base.h.

Referenced by BaseUtil::BaseLink(), and BaseInterface::Room::Click().

float BaseInterface::Room::Link::y

Definition at line 48 of file base.h.

Referenced by BaseUtil::BaseLink(), and BaseInterface::Room::Click().


The documentation for this class was generated from the following files: