示例#1
0
void WeatherPlugin::updateButton()
{
    if ((getTime() == 0) || (m_bar == NULL))
        return;
    const char **xpm = xpms[getIcon()];
    if (xpm){
        IconDef icon;
        icon.name = "weather";
        icon.xpm  = xpm;
        Event eIcon(EventAddIcon, &icon);
        eIcon.process();
    }
    QString text = unquoteText(getButtonText());
    QString tip = getTipText();
    text = replace(text);
    tip  = replace(tip);
    Command cmd;
    cmd->id		= CmdWeather;
    cmd->param	= m_bar;
    Event e(EventCommandWidget, cmd);
    CToolButton *btn = (CToolButton*)e.process();
    if (btn == NULL)
        return;
    btn->setTextLabel(text);
    btn->repaint();
    QToolTip::add(btn, tip);
}
示例#2
0
void CToolPopupPanel::OnLButtonDown(UINT nFlags, CPoint point)
{
	CToolButton* btn = GetToolButtonFromPos( point );
	if( btn ){
		btn->OnClick();
	}
	this->Invalidate (FALSE );

	CWnd::OnLButtonDown(nFlags, point);
}
示例#3
0
void WeatherPlugin::updateButton()
{
    if ((getTime() == 0) || (m_bar == NULL))
        return;
    const char **xpm = xpms[getIcon()];
    if (xpm){
        IconDef icon;
        icon.name = "weather";
        icon.xpm  = xpm;
        Event eIcon(EventAddIcon, &icon);
        eIcon.process();
    }
    QString text = unquoteText(getButtonText());
    QString tip = getTipText();
    QString ftip = getForecastText();
    text = replace(text);
    tip  = replace(tip);
	if (getForecast())
		tip = QString("<table><tr><td>") + tip + "</td><td>";
	unsigned n = (getForecast() + 1) / 2;
	if (n < 3)
		n = getForecast();
	for (m_day = 1; m_day <= getForecast(); m_day++){
		tip += forecastReplace(ftip);
	    const char **xpm = xpms[atol(getDayIcon(m_day))];
		if (xpm){
			string url = "weather";
			url += number(m_day);
			IconDef icon;
			icon.name = url.c_str();
			icon.xpm  = xpm;
			Event eIcon(EventAddIcon, &icon);
			eIcon.process();
		}
		if (--n == 0){
			tip += "</td><td>";
			n = (getForecast() + 1) / 2;
		}
	}
	if (getForecast())
		tip += "</td></tr></table>";
	tip += "<br>\nWeather data provided by weather.com";
	tip += QChar((unsigned short)176);
    Command cmd;
    cmd->id		= CmdWeather;
    cmd->param	= m_bar;
    Event e(EventCommandWidget, cmd);
    CToolButton *btn = (CToolButton*)e.process();
    if (btn == NULL)
        return;
    btn->setTextLabel(text);
    btn->repaint();
    QToolTip::add(btn, tip);
}
示例#4
0
void CToolPopupPanel::SetIEToolGroup(IEToolGroup *pTGroup)
{
	int size = pTGroup->GetToolSize();
	int i;
	for(i=0; i<size; i++){
		IIETool* pTool = pTGroup->GetToolAtIndex( i );

		CToolButton* pBtn = new CToolButton();
		pBtn->SetButton( pTool );

		m_ToolButton_Vec.push_back( pBtn );
	}
}
示例#5
0
void WeatherPlugin::updateButton()
{
    if ((getTime() == 0) || (m_bar == NULL))
        return;
    weather_icon = "weather";
    weather_icon += number(getIcon());
    Command cmd;
    cmd->id      = CmdWeather;
    cmd->text    = I18N_NOOP("Not connected");
    cmd->icon    = weather_icon.c_str();
    cmd->bar_id  = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags   = BTN_PICT | BTN_DIV;
    Event eCmd(EventCommandChange, cmd);
    eCmd.process();

    QString text = unquoteText(getButtonText());
    QString tip = getTipText();
    QString ftip = getForecastText();
    text = replace(text);
    tip  = replace(tip);
    if (getForecast())
        tip = QString("<table><tr><td>") + tip + "</td><td>";
    unsigned n = (getForecast() + 1) / 2;
    if (n < 3)
        n = getForecast();
    for (m_day = 1; m_day <= getForecast(); m_day++){
        tip += forecastReplace(ftip);
        if (--n == 0){
            tip += "</td><td>";
            n = (getForecast() + 1) / 2;
        }
    }
    if (getForecast())
        tip += "</td></tr></table>";
    tip += "<br>\nWeather data provided by weather.com";
    tip += QChar((unsigned short)174);
    Command cmdw;
    cmdw->id	= CmdWeather;
    cmdw->param	= m_bar;
    Event e(EventCommandWidget, cmdw);
    CToolButton *btn = (CToolButton*)e.process();
    if (btn == NULL)
        return;
    btn->setTextLabel(text);
    btn->repaint();
    QToolTip::add(btn, tip);
}
示例#6
0
void WeatherPlugin::updateButton()
{
    if ((getTime() == 0) || (m_bar == NULL))
        return;
    Command cmd;
    cmd->id      = CmdWeather;
    cmd->text    = I18N_NOOP("Not connected");
    cmd->icon    = "weather" + QString::number(getIcon());
    cmd->bar_id  = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags   = BTN_PICT | BTN_DIV;
    EventCommandChange(cmd).process();

    QString text = unquoteText(getButtonText());
    QString tip  = getTipText();
    QString ftip = i18n("<br><b>Forecast for</b><br>\n");
    ftip +=getForecastText();
    text = replace(text);
    tip  = replace(tip);
    if (getForecast())
        tip = QString("<table><tr><td>") + tip + "</td><td>";
    unsigned n = (getForecast() + 1) / 2;
    if (n < 3)
        n = getForecast();
    for (m_day = 1; m_day <= getForecast(); m_day++) {
        tip += forecastReplace(ftip);
        if (--n == 0) {
            tip += "</td><td>";
            n = (getForecast() + 1) / 2;
        }
    }
    if (getForecast())
        tip += "</td></tr></table>";
    tip += "<br>\n"+i18n("weather", "Weather data provided by weather.com&reg;");
    Command cmdw;
    cmdw->id	= CmdWeather;
    cmdw->param	= m_bar;
    EventCommandWidget eWidget(cmdw);
    eWidget.process();
    CToolButton *btn = dynamic_cast<CToolButton*>(eWidget.widget());
    if (btn == NULL)
        return;
    btn->setTextLabel(text);
    btn->repaint();
    QToolTip::add(btn, tip);
}
示例#7
0
void WeatherPlugin::updateButton()
{
    if ((getTime() == 0) || (m_bar == NULL))
        return;
    const char **xpm = NULL;
    QString conditions(getConditions());
    if (conditions == "Overcast"){
        xpm = overcast;
    }else if (conditions == "Fog"){
        xpm = fog;
    }else if (conditions == "Storm"){
        xpm = storm;
    }else if (conditions == "Rain"){
        xpm = rain;
    }else if (conditions == "Snow"){
        xpm = snow;
    }else if (conditions == "Cloudy"){
        xpm = snow;
    }else if (conditions == "Clear"){
        xpm = isDay() ? day : night;
    }else if (conditions == "Partial cloudy"){
        xpm = isDay() ? day_cloudy : night_cloudy;
    }
    if (xpm){
        IconDef icon;
        icon.name = "weather";
        icon.xpm  = xpm;
        Event eIcon(EventAddIcon, &icon);
        eIcon.process();
    }
    QString text = unquoteText(getButtonText());
    QString tip = getTipText();
    text = replace(text);
    tip  = replace(tip);
    Command cmd;
    cmd->id		= CmdWeather;
    cmd->param	= m_bar;
    Event e(EventCommandWidget, cmd);
    CToolButton *btn = (CToolButton*)e.process();
    if (btn == NULL)
        return;
    btn->setTextLabel(text);
    btn->repaint();
    QToolTip::add(btn, tip);
}
示例#8
0
void CToolPopupPanel::OnMouseMove(UINT nFlags, CPoint point)
{
	if(m_MouseEnterdCtrl == FALSE){
		TRACKMOUSEEVENT tme;
		tme.cbSize = sizeof(tme);
		tme.hwndTrack = this->GetSafeHwnd();
		tme.dwFlags = TME_LEAVE | TME_HOVER;
		tme.dwHoverTime = 1;
		m_MouseEnterdCtrl = _TrackMouseEvent( &tme );
	}

	//change all btn newtral
	CToolButton_Vec::iterator itr = m_ToolButton_Vec.begin();
	for(; itr != m_ToolButton_Vec.end(); itr++){
		if(!(*itr)->isClicked()){
			(*itr)->OnNewtral();
		}
	}

	//get tool btn under mouse
	CToolButton* btn = GetToolButtonFromPos( point );
	if( btn ){
		if(!btn->isClicked()){
			btn->OnMouseOn();
		}
		m_tool_tip_txt = btn->GetToolDisplayName();
		m_ToolTip.Update();
	}
	else{
		m_tool_tip_txt = "";
		m_ToolTip.Pop();
	}

	this->Invalidate (FALSE );
	CWnd::OnMouseMove(nFlags, point);
}