Beispiel #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.
  }
Beispiel #3
0
bool base_window::onTooltipHide()
{
	EventArgs a;
	a.name = "On_TooltipHide";
	callHandler(&a);
	return a.handled;
}
Beispiel #4
0
bool base_window::onCaptureLost(void)
{
	EventArgs a;
	a.name = "On_CaptureLost";
	callHandler(&a);
	return a.handled; 
}
Beispiel #5
0
bool base_window::onFocusGained(void)
{
	EventArgs a;
	a.name = "On_FocusGained";
	callHandler(&a);
	return a.handled; 
}
Beispiel #6
0
bool base_window::onSuspendLayout(void)
{
	EventArgs a;
	a.name = "On_SuspendLayout";
	callHandler(&a);
	return a.handled; 
}
Beispiel #7
0
bool base_window::onFocusLost(base_window* newFocus)
{
	EventArgs a;
	a.name = "On_FocusLost";
	callHandler(&a);
	return a.handled; 
}
Beispiel #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;
}
Beispiel #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;
}
Beispiel #10
0
bool base_window::onMouseLeave(void)
{
	MouseEventArgs m;
	m.name = "On_MouseLeave";
	callHandler(&m);
	return m.handled; 
}
Beispiel #11
0
void base_window::setVisible(bool visible) 
{
	EventArgs a;
	a.name = visible ? "On_Show" : "On_Hide";
	callHandler(&a);
	m_visible = visible;
}
Beispiel #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;
	}
Beispiel #13
0
bool base_window::onResumeLayout(void)
{
	EventArgs a;
	a.name = "On_ResumeLayout";
	callHandler(&a);
	return a.handled; 
}
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;

}
Beispiel #15
0
bool base_window::onChar(const wchar_t* text)
{
	KeyEventArgs k;
	k.name = "On_Char";
	k.ch = text;
	callHandler(&k);
	return k.handled; 
}
Beispiel #16
0
bool base_window::onMouseWheel(int delta)
{
	MouseEventArgs m;
	m.name = "On_MouseWheel";
	m.wheelDelta = delta;
	callHandler(&m);
	return m.handled; 
}
Beispiel #17
0
bool base_window::onMouseDouble(EventArgs::MouseButtons btn)
{
	MouseEventArgs m;
	m.name = "On_MouseDouble";
	m.mbutton = btn;
	callHandler(&m);
	return m.handled;
}
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);
}
Beispiel #19
0
bool base_window::onTick(float delta)
{
	TickEventArgs a;
	a.name = "On_Tick";
	a.delta = delta;
	callHandler(&a);
	return a.handled;
}
// 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);
  }
Beispiel #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; 
}
Beispiel #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; 
}
Beispiel #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; 
}
Beispiel #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();
	}
Beispiel #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();
		}
	}
Beispiel #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();
		}
	}
Beispiel #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);
	}
}
Beispiel #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);
	}
Beispiel #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;
}
Beispiel #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; 
}