SO3Engine
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Hikari::HikariManager Class Reference

#include <Hikari.h>

Public Types

typedef std::map< std::string, IFlashControl * > ControlMap
 

Public Member Functions

 HikariManager ()
 
 ~HikariManager ()
 
void destroy ()
 
void destroyFlashControl (IFlashControl *controlToDestroy)
 
void deleteControls ()
 
std::string getCurrentWorkingDirectory ()
 
void destroyFlashControl (const std::string &controlName)
 
void destroyAllControls ()
 
IFlashControlgetFlashControl (const std::string &controlName) const
 
void update ()
 
bool isAnyFocused ()
 
void defocusAll ()
 
bool injectMouseMove (short x, short y, int btn, bool ontex=true)
 
bool injectMouseDown (int buttonID)
 
bool injectMouseUp (int buttonID)
 
bool injectMouseWheel (int relScroll)
 
void injectKeyEvent (UINT msg, WPARAM wParam, LPARAM lParam)
 
void setKeyboardHookEnabled (bool isEnabled)
 
void setFlashControl (IFlashControl *flashControl)
 
void setPath (const std::string &assetsDirectory="")
 
bool isKeyboardOnGUI ()
 
bool focusControl (int x, int y, IFlashControl *selection=0)
 
IFlashControlgetFocusedControl ()
 
bool isPointOverHikari (short x, short y)
 

Static Public Member Functions

static HikariManagergetSingleton ()
 
static HikariManagergetSingletonPtr ()
 

Public Attributes

std::string basePath
 
HMODULE flashLib
 
IFlashControlfocusedControl
 
ControlMap controls
 

Protected Member Functions

IFlashControlgetTopControl (int x, int y)
 

Protected Attributes

Impl::KeyboardHookkeyboardHook
 
int mouseXPos
 
int mouseYPos
 
bool mouseButtonRDown
 
bool mInjectingKeyboardToFlash
 

Static Protected Attributes

static HikariManagermInstance = NULL
 

Friends

class IFlashControl
 
class Impl::KeyboardHook
 

Detailed Description

The HikariManager is used to HANDLE FlashControls and handle global events such as mouse-input propagation and the management of keyboard focus.

Definition at line 74 of file Hikari.h.

Member Typedef Documentation

◆ ControlMap

typedef std::map<std::string, IFlashControl*> Hikari::HikariManager::ControlMap

Definition at line 263 of file Hikari.h.

Constructor & Destructor Documentation

◆ HikariManager()

HikariManager::HikariManager ( )

Instantiates the HikariManager singleton. You can access the singleton later using the HikariManager::Get and GetPointer.

Parameters
assetsDirectorySpecifies the directory (relative to the path of the executable) that holds your .swf files. This is used by FlashControl::load.

Definition at line 61 of file Hikari.cpp.

◆ ~HikariManager()

HikariManager::~HikariManager ( )

Explicitly destroys the HikariManager singleton and destroys any active FlashControls.

Definition at line 84 of file Hikari.cpp.

Member Function Documentation

◆ defocusAll()

void HikariManager::defocusAll ( )

De-focuses any currently-focused FlashControl (removes keyboard focus).

Definition at line 239 of file Hikari.cpp.

◆ deleteControls()

void HikariManager::deleteControls ( )

Definition at line 171 of file Hikari.cpp.

◆ destroy()

void Hikari::HikariManager::destroy ( )
inline

Definition at line 102 of file Hikari.h.

◆ destroyAllControls()

void HikariManager::destroyAllControls ( )

Flags all FlashControls for destruction (to occur at the next update)

Definition at line 163 of file Hikari.cpp.

◆ destroyFlashControl() [1/2]

void HikariManager::destroyFlashControl ( const std::string &  controlName)

Flags the specified FlashControl for destruction (to occur at the next update)

Parameters
controlNameThe name of the control to flag for destruction.

Definition at line 156 of file Hikari.cpp.

◆ destroyFlashControl() [2/2]

void HikariManager::destroyFlashControl ( IFlashControl controlToDestroy)

DEPRECATED ********************* DEPRECATED Flags the specified FlashControl for destruction (to occur at the next update)

Parameters
controlToDestroyThe control to flag for destruction.

Definition at line 144 of file Hikari.cpp.

◆ focusControl()

bool HikariManager::focusControl ( int  x,
int  y,
IFlashControl selection = 0 
)

Definition at line 418 of file Hikari.cpp.

◆ getCurrentWorkingDirectory()

std::string HikariManager::getCurrentWorkingDirectory ( )

Definition at line 51 of file Hikari.cpp.

◆ getFlashControl()

IFlashControl * HikariManager::getFlashControl ( const std::string &  controlName) const

Retrieves a previously-created FlashControl by name.

Parameters
controlNameThe name of the FlashControl to retrieve.
Returns
If it is found, returns a pointer to the FlashControl, else returns 0.

Definition at line 183 of file Hikari.cpp.

◆ getFocusedControl()

IFlashControl * HikariManager::getFocusedControl ( )

Definition at line 224 of file Hikari.cpp.

◆ getSingleton()

HikariManager & HikariManager::getSingleton ( )
static

Retrieves the HikariManager singleton (must be instantiated first!)

Definition at line 118 of file Hikari.cpp.

◆ getSingletonPtr()

HikariManager * HikariManager::getSingletonPtr ( )
static

Retrieves a pointer to the HikariManager singleton.

Definition at line 126 of file Hikari.cpp.

◆ getTopControl()

IFlashControl * HikariManager::getTopControl ( int  x,
int  y 
)
protected

Definition at line 493 of file Hikari.cpp.

◆ injectKeyEvent()

void HikariManager::injectKeyEvent ( UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Injects a keyboard-event to be handled by the focused FlashControl. You generally don't need to call this unless you've disabled the keyboard-hook and wish to inject keyboard/IME messages directly from your WindowProc.

Parameters
msgSpecifies the message to be sent.
wParamSpecifies additional message-specific information.
lParamSpecifies additional message-specific information.
Note
You should only forward the following window messages using this function:
  • WM_KEYDOWN
  • WM_KEYUP
  • WM_CHAR
  • WM_DEADCHAR
  • WM_SYSKEYDOWN
  • WM_SYSKEYUP
  • WM_SYSDEADCHAR
  • WM_SYSCHAR
  • WM_IME_CHAR
  • WM_IME_COMPOSITION
  • WM_IME_COMPOSITIONFULL
  • WM_IME_CONTROL
  • WM_IME_ENDCOMPOSITION
  • WM_IME_KEYDOWN
  • WM_IME_KEYUP
  • WM_IME_NOTIFY
  • WM_IME_REQUEST
  • WM_IME_SELECT
  • WM_IME_SETCONTEXT
  • WM_IME_STARTCOMPOSITION
  • WM_HELP
  • WM_CANCELMODE

Definition at line 388 of file Hikari.cpp.

◆ injectMouseDown()

bool HikariManager::injectMouseDown ( int  buttonID)

Injects a global mouse-down to be handled by all FlashControl overlays.

Parameters
buttonIDThe MouseButtonID of the pressed button.
Returns
Returns true if the mouse event was handled by a FlashControl overlay, else returns false.

Definition at line 290 of file Hikari.cpp.

◆ injectMouseMove()

bool HikariManager::injectMouseMove ( short  x,
short  y,
int  btn,
bool  ontex = true 
)

Injects a global mouse-move to be handled by all FlashControl overlays.

Parameters
xThe absolute x-coordinate in screen-space.
yThe absolute y-coordinate in screen-space.
Returns
Returns true if the coordinates are over a FlashControl overlay, else returns false.

Definition at line 244 of file Hikari.cpp.

◆ injectMouseUp()

bool HikariManager::injectMouseUp ( int  buttonID)

Injects a global mouse-up to be handled by all FlashControl overlays.

Parameters
buttonIDThe MouseButtonID of the released button.
Returns
Returns true if the mouse event was handled by a FlashControl overlay, else returns false.

Definition at line 337 of file Hikari.cpp.

◆ injectMouseWheel()

bool HikariManager::injectMouseWheel ( int  relScroll)

Injects a global mouse-wheel event to be handled by all FlashControl overlays.

Parameters
relScrollThe relative scroll amount of the mouse (in OIS, this is arg.state.Z.rel).
Returns
Returns true if the mouse event was handled by a FlashControl overlay, else returns false.

Definition at line 374 of file Hikari.cpp.

◆ isAnyFocused()

bool HikariManager::isAnyFocused ( )

Returns whether or not any FlashControl is focused (and is capturing keyboard input).

Definition at line 233 of file Hikari.cpp.

◆ isKeyboardOnGUI()

bool HikariManager::isKeyboardOnGUI ( )

Definition at line 113 of file Hikari.cpp.

◆ isPointOverHikari()

bool HikariManager::isPointOverHikari ( short  x,
short  y 
)

Definition at line 273 of file Hikari.cpp.

◆ setFlashControl()

void HikariManager::setFlashControl ( IFlashControl flashControl)

Definition at line 514 of file Hikari.cpp.

◆ setKeyboardHookEnabled()

void HikariManager::setKeyboardHookEnabled ( bool  isEnabled)

Sets whether or not the keyboard-hook is enabled and should automatically catch and forward all keyboard messages to the focused FlashControl. (Enabled by default)

Parameters
isEnabledWhether or not the keyboard-hook is enabled.
Note
For some reason, IME doesn't work properly using the the keyboard hook to catch keyboard messages and so, as a workaround, you can disable the keyboard-hook and forward keyboard/IME messages directly to Hikari from your main window's WindowProc.

Definition at line 401 of file Hikari.cpp.

◆ setPath()

void HikariManager::setPath ( const std::string &  assetsDirectory = "")

Definition at line 134 of file Hikari.cpp.

◆ update()

void HikariManager::update ( )

Gives each active FlashControl a chance to update and destroys any control that is flagged for destruction.

Definition at line 192 of file Hikari.cpp.

Friends And Related Symbol Documentation

◆ IFlashControl

friend class IFlashControl
friend

Definition at line 284 of file Hikari.h.

◆ Impl::KeyboardHook

friend class Impl::KeyboardHook
friend

Definition at line 285 of file Hikari.h.

Member Data Documentation

◆ basePath

std::string Hikari::HikariManager::basePath

Definition at line 257 of file Hikari.h.

◆ controls

ControlMap Hikari::HikariManager::controls

Definition at line 264 of file Hikari.h.

◆ flashLib

HMODULE Hikari::HikariManager::flashLib

Definition at line 261 of file Hikari.h.

◆ focusedControl

IFlashControl* Hikari::HikariManager::focusedControl

Definition at line 262 of file Hikari.h.

◆ keyboardHook

Impl::KeyboardHook* Hikari::HikariManager::keyboardHook
protected

Definition at line 276 of file Hikari.h.

◆ mInjectingKeyboardToFlash

bool Hikari::HikariManager::mInjectingKeyboardToFlash
protected

Definition at line 282 of file Hikari.h.

◆ mInstance

HikariManager * HikariManager::mInstance = NULL
staticprotected

Definition at line 269 of file Hikari.h.

◆ mouseButtonRDown

bool Hikari::HikariManager::mouseButtonRDown
protected

Definition at line 279 of file Hikari.h.

◆ mouseXPos

int Hikari::HikariManager::mouseXPos
protected

Definition at line 278 of file Hikari.h.

◆ mouseYPos

int Hikari::HikariManager::mouseYPos
protected

Definition at line 278 of file Hikari.h.


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