예제 #1
0
void CDNewsImageController::initImageTableView()
{
    if (m_ImageMsg.empty()) {
        showAlert();
        return;
    }

    if (p_TableView!=NULL)
    {
        this->getView()->removeSubview(p_TableView);
        p_TableView = NULL;
    }
    p_TableView= CATableView::createWithFrame(DRect(0, 0, winSize.width, winSize.height));
    p_TableView->setTableViewDataSource(this);
    p_TableView->setTableViewDelegate(this);
    p_TableView->setAllowsSelection(true);
    p_TableView->setScrollViewDelegate(this);
    p_TableView->setAllowsMultipleSelection(false);
    p_TableView->setSeparatorViewHeight(40);
    p_TableView->setSeparatorColor(ccc4(240,240,240,255));
    this->getView()->addSubview(p_TableView);
    CAPullToRefreshView *refreshDiscount = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeFooter);
    refreshDiscount->setLabelColor(CAColor_black);
    CAPullToRefreshView *refreshDiscount1 = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
    refreshDiscount1->setLabelColor(CAColor_black);
    p_TableView->setFooterRefreshView(refreshDiscount);
    p_TableView->setHeaderRefreshView(refreshDiscount1);
}
예제 #2
0
static PyObject *alert_alert(PyObject *self, PyObject *args, PyObject *kwds)
{
	char *msg = NULL, *title = "AutoPy Alert";
	char *default_button = "OK", *cancel_button = NULL;

	static char *kwdlist[] = {"title", "msg", "default_button",
	                          "cancel_button", NULL};
	int button;

	if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|szz", kwdlist,
	                                 &msg,
	                                 &title,
	                                 &default_button,
	                                 &cancel_button)) {
		return NULL;
	}

	button = showAlert(title, msg, default_button, cancel_button);
	if (button == 0) {
		Py_RETURN_TRUE;
	} else if (button == 1) {
		Py_RETURN_FALSE;
	} else {
		PyErr_SetString(PyExc_OSError, "Could not display alert");
		return NULL;
	}
}
예제 #3
0
void CDNewsViewController::initNewsTableView()
{
    if (m_page.empty())
    {
        showAlert();
        return;
    }
    if (p_TableView!=NULL)
    {
        this->getView()->removeSubview(p_TableView);
        p_TableView = NULL;
    }
    
    p_TableView= CATableView::createWithFrame(DRect(0, 0, winSize.width, winSize.height));
    p_TableView->setTableViewDataSource(this);
    p_TableView->setTableViewDelegate(this);
    p_TableView->setScrollViewDelegate(this);
    p_TableView->setAllowsSelection(true);
    this->getView()->addSubview(p_TableView);
    CAPullToRefreshView *refreshDiscount = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeFooter);
    refreshDiscount->setLabelColor(CAColor_black);
    CAPullToRefreshView *refreshDiscount1 = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
    refreshDiscount1->setLabelColor(CAColor_black);
    p_TableView->setFooterRefreshView(refreshDiscount);
    p_TableView->setHeaderRefreshView(refreshDiscount1);
    
    initNewsPageView();
}
예제 #4
0
void sendHttpReq(HttpRequest* request, Params params /*= nullptr*/, size_t size /*=0*/, bool checkNetwork /*= false*/)
{
    if (!request) {
        return;
    }
    HttpCallback* httpCallback = _httpMap[request->getTag()];
    if (!httpCallback) {
        return;         //because the req has been sent before and httpCallback was released
    }
    if (checkNetwork && !networkReachable()) {
        TempVar* strings = VARIABLES_LOCAL("strings.json");
        showAlert(strings->getString("dialog_title_tip").c_str(), strings->getString("network_unreachable").c_str(), NULL, strings->getString("dialog_btn_ok").c_str(), nullptr);
        return;
    }
    if(params!=NULL&&size != 0){
        std::string data = formatParams(params, size);
        switch (request->getRequestType()) {
            case HttpRequest::Type::PUT:
            case HttpRequest::Type::POST:
            {
                request->setRequestData(data.c_str(), (unsigned int)data.length());
                break;
            }
            case HttpRequest::Type::DELETE:
            case HttpRequest::Type::GET:
            {
                const char* url = request->getUrl();
                std::string strUrl(url);
                strUrl.append("?");
                strUrl.append(data);
                request->setUrl(strUrl.c_str());
                break;
            }
            default:
                log("unknown request type.");
                break;
        }
    }
    HttpClient::getInstance()->send(request);
    request->release();
    httpCallback->state = Sending;
    /*show dialog*/
    if(httpCallback->dlg)
        httpCallback->dlg->retain();
}
void SessionsViewController::initMsgTableView()
{
    if (m_msg.empty())
    {
        showAlert();
        return;
    }
    if (m_msgTableView != NULL)
    {
        this->getView()->removeSubview(m_msgTableView);
        m_msgTableView = NULL;
    }
    
    m_msgTableView = CATableView::createWithFrame(DRect(0, _px(120), m_winSize.width, m_winSize.height - _px(120)));
    m_msgTableView->setTableViewDataSource(this);
    m_msgTableView->setTableViewDelegate(this);
    m_msgTableView->setScrollViewDelegate(this);
    m_msgTableView->setAllowsSelection(true);
    m_msgTableView->setSeparatorColor(ccc4(200, 200, 200, 80));
    //m_msgTableView->setSeparatorViewHeight(_px(2));
    this->getView()->addSubview(m_msgTableView);
}
예제 #6
0
파일: FroggMain.cpp 프로젝트: ullerrm/frogg
int main(int argc, char **argv)
{
    /* Jaguar has a bug where certain events aren't properly dispatched if  */
    /* the Process Manager isn't initialized.  (bug ref: 2998556)  Request  */
    /* a junk process number to force PM to fully initialize, instead of    */
    /* just a lazy init when we call thread functions later on in playback. */

    ProcessSerialNumber junkPSN;
    GetCurrentProcess(&junkPSN);

    /* Load GUI elements and a single player object, and enter main loop.   */

    if (!initControls())
    {
        showAlert(ALERT_STOP, "An error occurred in Frogg while creating an audio channel!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 1;
    }
    
    if (!installAEHandlers())
    {
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while registering AppleScript handlers!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 2;
    }

    if (!loadInfoWin())
    {
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while loading the tag browser window from its nib file!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 3;
    }
    
    if (!loadAboutWin())
    {
        unloadInfoWin();
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while loading the about window from its nib file!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 4;
    }

    if (!loadPrefsWin())
    {        
        unloadAboutWin();
        unloadInfoWin();
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while loading the preferences window from its nib file!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 5;
    }

    if (!loadPlayerWin(getSavedUseMetal()))
    {
        unloadPrefsWin();
        unloadAboutWin();
        unloadInfoWin();
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while loading the player window from its nib file!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 6;
    }

    if (!loadMenuBar())
    {
        unloadPlayerWin();
        unloadPrefsWin();
        unloadAboutWin();
        unloadInfoWin();
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while loading the menu bar from its nib file!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 7;
    }

    if (!showPlayerWin())
    {
        unloadMenuBar();
        unloadPlayerWin();
        unloadPrefsWin();
        unloadAboutWin();
        unloadInfoWin();
        removeAEHandlers();
        killControls();
        showAlert(ALERT_STOP, "An error occurred in Frogg while displaying the player window!", "Debugging output has been written to the System Console - please email it to [email protected]!", "Abort");
        return 8;
    }

    RunApplicationEventLoop();

    unloadMenuBar();
    unloadPlayerWin();
    unloadPrefsWin();
    unloadAboutWin();
    unloadInfoWin();
    removeAEHandlers();
    killControls();
    
    return 0;
}
예제 #7
0
void Alert::show()
{
    showAlert(title, message, buttons, delegate);
}
void SessionsViewController::initMsgTableView()
{
    if (m_msg->empty())
    {
        showAlert();
        return;
    }
    if (m_msgTableView == NULL)
    {
        m_listView = CAListView::createWithFrame(DRect(0,(120),m_winSize.width,(60)));
        m_listView->setListViewDelegate(this);
        m_listView->setListViewDataSource(this);
        m_listView->setAllowsSelection(true);
        m_listView->setAllowsMultipleSelection(false);
        m_listView->setListViewOrientation(CAListViewOrientationHorizontal);
        m_listView->setShowsScrollIndicators(false);
        m_listView->setSeparatorColor(ccc4(0xf6, 0xf6, 0xf6, 0xff));
        m_listView->setBackgroundImage(CAImage::create("common/gray_bg.png"));
        m_listView->setTag(1);
        //m_listView->setc
        this->getView()->addSubview(m_listView);
        
        m_msgTableView = CATableView::createWithFrame(DRect(0, (180), m_winSize.width, m_winSize.height - (180)));
        m_msgTableView->setTableViewDataSource(this);
        m_msgTableView->setTableViewDelegate(this);
        m_msgTableView->setScrollViewDelegate(this);
        m_msgTableView->setAllowsSelection(true);
        m_msgTableView->setSeparatorColor(ccc4(200, 200, 200, 80));
        //m_msgTableView->setSeparatorViewHeight((2));
        this->getView()->addSubview(m_msgTableView);
        
        CAPullToRefreshView *refreshDiscount = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
        refreshDiscount->setLabelColor(CAColor_black);
        m_msgTableView->setHeaderRefreshView(refreshDiscount);


		m_filterView = CAView::createWithFrame(DRect(0, (120), m_winSize.width, (60)));
		CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
		imageView->setFrame(DRect(0, 0, m_winSize.width, (60)));
		m_filterView->addSubview(imageView);
		this->getView()->addSubview(m_filterView);
		m_filterViewVec.push_back(m_filterView);

		for (int i = 0; i < 2; i++)
		{
            int cnt = 0;
            if (i == 0) {
                cnt = TrackNum;
            } else if (i == 1) {
                cnt = FormatNum;
            }
			m_filterBtn[i] = CAButton::createWithFrame(DRect(i * m_winSize.width / 2, 0, m_winSize.width / 2, (60)), CAButtonTypeCustom);
			m_filterBtn[i]->setTitleForState(CAControlStateAll, filterItem[i]);
			m_filterBtn[i]->setTitleFontName(SAP_FONT_ARIAL);
            m_filterBtn[i]->setTitleFontSize((30));
			m_filterBtn[i]->setTitleColorForState(CAControlStateAll, CAColor_gray);
			m_filterBtn[i]->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
			m_filterBtn[i]->setTag(300 + i);
			m_filterBtn[i]->setAllowsSelected(true);
			m_filterView->addSubview(m_filterBtn[i]);

			m_downView[i] = CAView::createWithFrame(DRect(i * m_winSize.width / 2, (180), m_winSize.width / 2, (50) * cnt + (20)));
			CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
			imageView->setFrame(DRect(0, 0, m_winSize.width / 2, (50) * cnt + (20)));
			m_downView[i]->addSubview(imageView);
			this->getView()->addSubview(m_downView[i]);
			m_filterViewVec.push_back(m_downView[i]);
		}

		for (int i = 0; i < m_filterViewVec.size(); i++)
		{
			m_filterViewVec[i]->setVisible(false);
		}

		for (int i = 0; i < TrackNum; i++)
		{
			CAButton* button = CAButton::createWithFrame(DRect((20), (50) * i, m_winSize.width / 2 - (40), (50)), CAButtonTypeCustom);
			button->setTitleForState(CAControlStateAll, trackFilterItem[i]);
			button->setTitleFontName(SAP_FONT_ARIAL);
			button->setTitleColorForState(CAControlStateAll, CAColor_gray);
            button->setTitleColorForState(CAControlStateSelected, CAColor_white);
			button->setTitleFontSize((27));
			button->setAllowsSelected(true);
			//CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/white_bg.png"));
			//button->setBackgroundViewForState(CAControlStateAll, imageView);
			CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/sky_bg.png"));
			button->setBackgroundViewForState(CAControlStateSelected, imageView);
			button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
			button->setTag(400 + i);
			m_downView[0]->addSubview(button);
			m_trackButtonVec.push_back(button);
		}

		for (int i = 0; i < FormatNum; i++)
		{
			CAButton* button = CAButton::createWithFrame(DRect((20), (50) * i, m_winSize.width / 2 - (40), (50)), CAButtonTypeCustom);
			button->setTitleForState(CAControlStateAll, formatFilterItem[i]);
			button->setTitleFontName(SAP_FONT_ARIAL);
			button->setTitleColorForState(CAControlStateAll, CAColor_gray);
            button->setTitleColorForState(CAControlStateSelected, CAColor_white);
			button->setTitleFontSize((27));
			button->setAllowsSelected(true);
			//CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/white_bg.png"));
			//button->setBackgroundViewForState(CAControlStateAll, imageView);
			CAImageView* imageView = CAImageView::createWithImage(CAImage::create("common/sky_bg.png"));
			button->setBackgroundViewForState(CAControlStateSelected, imageView);
			button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
			button->setTag(500 + i);
			m_downView[1]->addSubview(button);
			m_formatButtonVec.push_back(button);
		}
    }
}
예제 #9
0
S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type)
{
	return showAlert(text, caption, type);
}