Exemplo n.º 1
0
	/// Trigger an event on this control.
	/// @tparam t The type of event to trigger.
	/// @tparam Params Additional parameters, depending on the event type.
	/// @param dlg The parent dialog of this control.
	/// @param args Additional arguments, depending on the event type.
	/// @return The result of the event handler. If there was no handler, and the handler would've returned a bool,
	/// then true is returned. This also applies if the event type is not supported by the control.
	template<eDlogEvt t, typename... Params> typename event_fcn<t>::type::result_type triggerEvent(cDialog& dlg, Params... args) {
		using fcn_t = typename event_fcn<t>::type;
		if(event_handlers[t].empty())
			return callHandler(fcn_t(), dlg, args...);
		auto handler = boost::any_cast<fcn_t>(event_handlers[t]);
		return callHandler(handler, dlg, args...);
	}
// Switch UI to desired Mode
  byte OSLocalUI::set_mode(char mode)
  {
        osUI_Mode = mode;
        osUI_Page = 0;

       return callHandler(2);    // call MODE handler, indicating that it needs to setup things.
  }
Exemplo n.º 3
0
bool base_window::onTooltipHide()
{
	EventArgs a;
	a.name = "On_TooltipHide";
	callHandler(&a);
	return a.handled;
}
Exemplo n.º 4
0
bool base_window::onCaptureLost(void)
{
	EventArgs a;
	a.name = "On_CaptureLost";
	callHandler(&a);
	return a.handled; 
}
Exemplo n.º 5
0
bool base_window::onFocusGained(void)
{
	EventArgs a;
	a.name = "On_FocusGained";
	callHandler(&a);
	return a.handled; 
}
Exemplo n.º 6
0
bool base_window::onSuspendLayout(void)
{
	EventArgs a;
	a.name = "On_SuspendLayout";
	callHandler(&a);
	return a.handled; 
}
Exemplo n.º 7
0
bool base_window::onFocusLost(base_window* newFocus)
{
	EventArgs a;
	a.name = "On_FocusLost";
	callHandler(&a);
	return a.handled; 
}
Exemplo n.º 8
0
bool Button::onMouseButton(EventArgs::MouseButtons btn, EventArgs::ButtonState state)
{
	if(btn == EventArgs::Left)
	{
		if(state == EventArgs::Down)
		{
			m_system.queryCaptureInput(this);
			m_pushed = true;
			invalidate();
		}
		else
		{
			m_system.queryCaptureInput(0);
			m_pushed = false;
			
			point pt = transformToWndCoord(m_system.getCursor().getPosition());
			if(m_area.isPointInRect(pt))
			{
				MouseEventArgs m;
				m.name = "On_Clicked";
				callHandler(&m);

				send_event(events::ClickEvent());
			}
			invalidate();
		}
	}
	Label::onMouseButton(btn, state);
	return true;
}
Exemplo n.º 9
0
bool Button::onKeyboardButton(EventArgs::Keys key, EventArgs::ButtonState state)
{
	Label::onKeyboardButton(key, state);

	switch(key)
	{
	case EventArgs::K_SPACE:
	case EventArgs::K_RETURN:
	case EventArgs::K_EXECUTE:
		if(state == EventArgs::Down)
		{
			//m_system.queryCaptureInput(this);
			m_pushed = true;
		}
		else
		{
			//m_system.queryCaptureInput(0);
			m_pushed = false;
			MouseEventArgs m;
			m.name = "On_Clicked";
			callHandler(&m);

			send_event(events::ClickEvent());
		}
		invalidate();
		return true;
		break;
	};
	return false;
}
Exemplo n.º 10
0
bool base_window::onMouseLeave(void)
{
	MouseEventArgs m;
	m.name = "On_MouseLeave";
	callHandler(&m);
	return m.handled; 
}
Exemplo n.º 11
0
void base_window::setVisible(bool visible) 
{
	EventArgs a;
	a.name = visible ? "On_Show" : "On_Hide";
	callHandler(&a);
	m_visible = visible;
}
Exemplo n.º 12
0
	bool FrameWindow::onMouseMove(void)
	{
		if(m_tracking)
		{
			point pt = transformToWndCoord(m_system.getCursor().getPosition());
			point newpos = pt - m_offset;

			Rect testarea(m_area);
			testarea.setPosition(newpos);

			if(m_clampToScreen && m_parent)
			{
				Size me = m_area.getSize();
				Size max = m_parent->getSize();
				if(testarea.m_left < 0.f)
					testarea.m_left = 0.f;
				if(testarea.m_top < 0.f)
					testarea.m_top = 0.f;
				if(testarea.m_right > max.width)
					testarea.m_left = max.width - me.width;
				if(testarea.m_bottom > max.height)
					testarea.m_top = max.height - me.height;

				testarea.setSize(me);
			}
			
			setArea(testarea);

			EventArgs a;
			a.name = "On_Move";
			callHandler(&a);
		}
		return true;
	}
Exemplo n.º 13
0
bool base_window::onResumeLayout(void)
{
	EventArgs a;
	a.name = "On_ResumeLayout";
	callHandler(&a);
	return a.handled; 
}
Exemplo n.º 14
0
natural HttpReqImpl::forwardRequest(ConstStrA vpath, IHttpHandler **h) {
	IHttpHandler *hx;
	natural r = callHandler(vpath,&hx);
	if (hx != 0) curHandler = hx;
	if (h) *h = hx;
	return r;

}
Exemplo n.º 15
0
bool base_window::onChar(const wchar_t* text)
{
	KeyEventArgs k;
	k.name = "On_Char";
	k.ch = text;
	callHandler(&k);
	return k.handled; 
}
Exemplo n.º 16
0
bool base_window::onMouseWheel(int delta)
{
	MouseEventArgs m;
	m.name = "On_MouseWheel";
	m.wheelDelta = delta;
	callHandler(&m);
	return m.handled; 
}
Exemplo n.º 17
0
bool base_window::onMouseDouble(EventArgs::MouseButtons btn)
{
	MouseEventArgs m;
	m.name = "On_MouseDouble";
	m.mbutton = btn;
	callHandler(&m);
	return m.handled;
}
Exemplo n.º 18
0
void InviteSessionHandler::onTerminated(resip::InviteSessionHandle handle,
      resip::InviteSessionHandler::TerminatedReason reason,
      const resip::SipMessage* related)
{
   // TODO: add TerminatedReason
   callHandler(handle->getAppDialogSet(), "terminated", &handle, 0, 0,
         related, 0);
}
Exemplo n.º 19
0
bool base_window::onTick(float delta)
{
	TickEventArgs a;
	a.name = "On_Tick";
	a.delta = delta;
	callHandler(&a);
	return a.handled;
}
Exemplo n.º 20
0
// Main loop. Intended to be called regularly and frequently to handle input and UI. Normally this will be called from Arduino loop()
  byte OSLocalUI::loop(void)
  {
    if( osUI_State != OSUI_STATE_ENABLED ) return true; //UI update disabled, nothing to do - exit

// local UI is enabled, call appropriate handler

     return callHandler(0);
  }
Exemplo n.º 21
0
bool base_window::onKeyboardButton(EventArgs::Keys key, EventArgs::ButtonState state)
{
	KeyEventArgs k;
	k.name = "On_KeyboardButton";
	k.button = key;
	k.state = state;
	callHandler(&k);
	return k.handled; 
}
Exemplo n.º 22
0
bool base_window::onMouseButton(EventArgs::MouseButtons btn, EventArgs::ButtonState state)
{
	MouseEventArgs m;
	m.name = "On_MouseButton";
	m.mbutton = btn;
	m.mstate = state;
	callHandler(&m);
	return m.handled; 
}
Exemplo n.º 23
0
bool base_window::onMouseMove(void)
{
	MouseEventArgs m;
	m.name = "On_MouseMove";
	point pt = m_system.getCursor().getPosition();
	m.mouseX = pt.x;
	m.mouseY = pt.y;
	callHandler(&m);
	return m.handled; 
}
Exemplo n.º 24
0
	void MarkupText::hideTooltip()
	{
		if(m_selectedtt)
		{
			MarkupEventArgs m;
			m.name = "On_MarkupTooltipHide";
			m.id = (unsigned int)m_selectedtt->tooltip;
			callHandler(&m);

			m_system.getTooltip()->reset();
		}
		m_selectedtt.reset();
	}
Exemplo n.º 25
0
	void MarkupText::showTooltip(PTooltipArea p)
	{
		if(p)
		{
			m_selectedtt = p;
			MarkupEventArgs m;
			m.name = "On_MarkupTooltipShow";
			m.id = (unsigned int)p->tooltip;
			callHandler(&m);

			m_system.getTooltip()->show();
		}
	}
Exemplo n.º 26
0
	void Slider::onTrack(const events::TrackEvent& e)
	{
		if(m_thumb)
		{
			m_pos = m_thumb->getProgress();

			EventArgs e;
			e.name = "On_Tracked";
			callHandler(&e);
			
			send_event(events::TrackEvent());
			invalidate();
		}
	}
Exemplo n.º 27
0
//RPLENDOFNAMES start
void lolIRC::Client::lolIRC_Client::lolIRC_Response_RPLENDOFNAMES::doIt(lolIRC_Message& m)
{
	std::list<std::string>::iterator it = m.parameters.begin(); //List of parameters

	if((*it).compare(client.nick))
		DEBUG_PRINT("You're doing it wrong!");

	it++; //Channel name

	for(std::list<lolIRC_Channel>::iterator i = client.channels.begin(); i != client.channels.end(); i++)
	{
		if(!((*i).getChannelName().compare(*it)))
			callHandler(*i);
	}
}
Exemplo n.º 28
0
	bool MarkupText::onMouseButton(EventArgs::MouseButtons btn, EventArgs::ButtonState state)
	{
		if(m_selectedlnk)
		{
			MarkupEventArgs m;
			m.name = "On_MarkupMouseButton";
			m.mbutton = btn;
			m.mstate = state;
			m.id = (unsigned int)m_selectedlnk->id;
			m.type = m_selectedlnk->type.c_str();
			callHandler(&m);
			return m.handled;
		}
		return MarkupBase::onMouseButton(btn, state);
	}
Exemplo n.º 29
0
bool base_window::onMoved(void)
{
	if(m_parent)
	{
		Stick();
		const Rect& pr = m_parent->getArea();
		Rect area(m_area);
		area.offset(pr.getPosition());

		m_alignmentRect.m_left = area.m_left - pr.m_left;
		m_alignmentRect.m_top = area.m_top - pr.m_top;
		m_alignmentRect.m_right = pr.m_right - area.m_right;
		m_alignmentRect.m_bottom = pr.m_bottom - area.m_bottom;
	}
	invalidate();
	EventArgs a;
	a.name = "On_Moved";
	callHandler(&a);
	return true;
}
Exemplo n.º 30
0
bool base_window::onLoad(void)
{
	onMoved();
	if(m_alwaysOnTop)
		moveToFront();

	HandlerMap::iterator it = m_handlers.find("On_Draw");
	if(it != m_handlers.end())
	{
		m_drawhandler = it->second;
		if(!m_drawhandler.empty())
		{
			m_customDraw = true;
		}
	}

	EventArgs a;
	a.name = "On_Load";
	callHandler(&a);
	return a.handled; 
}