本文整理汇总了C++中MakeDelegate函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeDelegate函数的具体用法?C++ MakeDelegate怎么用?C++ MakeDelegate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeDelegate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(ThreadBehavior, StartOnce)
{
AutoPtr<PlatformFixture> fixture(new PlatformFixture);
Thread::StartDelegate d(MakeDelegate(&dummy));
Thread t(d);
fixture->threadImpl->startSuccess = Threading::Status_NoError;
//, "Expected that Thread::start() would succeed if ThreadImpl::start succeds"
EXPECT_TRUE(t.start() == Threading::Status_NoError);
//, "Expected that Thread::start() would fail if called a second time"
EXPECT_TRUE(t.start() == Threading::Status_Again);
}
示例2: UIElement
/* Public */
Camera::Camera(const Point2i &position, const Point2i &dimensions, const Point2i &frameDimensions, const Point2i &textureDimensions) :
UIElement(position, dimensions)
{
this->frameDimensions = frameDimensions;
int px = position.getX();
int py = position.getY() + dimensions.getY() - CONTROL_BAR_HEIGHT;
int dx = dimensions.getX() - 125;
int dy = CONTROL_BAR_HEIGHT;
controls = new CameraControls(Point2i(px, py), Point2i(dx, dy));
controls->setClickedCallback(MakeDelegate(this, &Camera::controls_Clicked));
registerEventHandler(controls);
mode = new ModeToggle(Point2i(dx, py), Point2i(125, dy), "switch_slide.png", "switch_rub.png");
mode->setClickedCallback(MakeDelegate(this, &Camera::mode_Clicked));
registerEventHandler(mode);
GLfloat data[12] =
{
0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
1.0f, 0.0f, 0.0f,
1.0f, 1.0f, 0.0f
};
float u0 = 0.0f;
float u1 = (float)frameDimensions.getX() / (float)textureDimensions.getX();
float v0 = 0.0f;//
float v1 = (float)frameDimensions.getY() / (float)textureDimensions.getY();
GLfloat textureData[8] =
{
u0, v1,
u1, v1,
u0, v0,
u1, v0
};
vbo = new GLVbo(GL_TRIANGLE_STRIP, GL_STATIC_DRAW, data, 4, textureData);
}
示例3: ColourPicker
void WheelMenu::initMenuItems(void)
{
unsigned int width = dimensions.getX();
sound = new ColourPicker(Sounds::getSounds(), "Sound", position, width);
sound->setSelectionChangedCallback(MakeDelegate(this, &WheelMenu::sound_SelectionChanged));
addMenuItem(*sound);
size = new Slider("Size", position, width);
size->setValueChangedCallback(MakeDelegate(this, &WheelMenu::size_ValueChanged));
addMenuItem(*size);
rate = new Slider("Rate", position, width);
rate->setValueChangedCallback(MakeDelegate(this, &WheelMenu::rate_ValueChanged));
addMenuItem(*rate);
pattern = new PatternPicker(8, "Pattern", position, width);
pattern->setPatternChangedCallback(MakeDelegate(this, &WheelMenu::pattern_PatternChanged));
addMenuItem(*pattern);
sync = new Button("Sync", position, width);
sync->setClickedCallback(MakeDelegate(this, &WheelMenu::sync_Clicked));
addMenuItem(*sync);
if(mode == INSPECT)
{
erase = new Button("Erase", position, width);
erase->setClickedCallback(MakeDelegate(this, &WheelMenu::erase_Clicked));
addMenuItem(*erase);
}
}
示例4: cb
CTreeTab::CTreeTab(CPaintManagerUI* ppm)
{
CDialogBuilder builder;
CDialogBuilderCallbackEx cb (ppm);
CContainerUI* pbtnTab = static_cast<CContainerUI*>(builder.Create(_T("tree.xml"), 0, &cb, ppm));
if( pbtnTab ) {
this->Add(pbtnTab);
}
else {
this->RemoveAll();
return;
}
CDuiTreeView* pTree1 = static_cast<CDuiTreeView*>(pbtnTab->FindSubControl(_T("Tree1")));
pTree1->OnNotify += MakeDelegate(this,&CTreeTab::OnFolderChanged);
if (pTree1) {
pTree1->SetDepth(4);
pTree1->SetExpandImage(_T("tree_expand.png"));
CDuiTreeView::Node* pCategoryNode = NULL;
CDuiTreeView::Node* pGameNode = NULL;
CDuiTreeView::Node* pServerNode = NULL;
CDuiTreeView::Node* pRoomNode = NULL;
pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÍƼöÓÎÏ·"));
for (int i = 0; i < 4; ++i)
{
pGameNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}ËÄÈ˶·µØÖ÷"), pCategoryNode);
for (int i = 0; i < 3; ++i)
{
pServerNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·þÎñÆ÷"), pGameNode);
for (int i = 0; i < 3; ++i)
{
pRoomNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·¿¼ä"), pServerNode);
}
}
}
pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}×î½üÍæ¹ýµÄÓÎÏ·"));
for (int i = 0; i < 2; ++i)
{
pTree1->AddNode(_T("Èýȱһ"), pCategoryNode);
}
pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÆåÅÆÓÎÏ·"));
for (int i = 0; i < 8; ++i)
{
pTree1->AddNode(_T("Ë«¿Û"), pCategoryNode);
}
pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÐÝÏÐÓÎÏ·"));
for (int i = 0; i < 8; ++i)
{
pTree1->AddNode(_T("·ÉÐÐÆå"), pCategoryNode);
}
}
}
示例5: udp_params
CamSyncReceiver::CamSyncReceiver()
{
udp_params params = udp_params();
params.remote_ip = inet_addr(CAMSYNC_BROADCAST_IP);
params.local_port = CAMSYNC_BROADCAST_PORT;
params.reuse_addr = 1;
conn = new udp_connection (params);
conn->set_callback (MakeDelegate(this,&CamSyncReceiver::UDPCallback),conn);
sequenceNumber=0;
packetCount=0;
dropCount=0;
printf("Camera Sync RX Interface Initialized. %s:%d\r\n",CAMSYNC_BROADCAST_IP,CAMSYNC_BROADCAST_PORT);
}
示例6: MakeDelegate
//************************************
// 函数名称: AddAt
// 返回类型: long
// 参数信息: CTreeNodeUI * pControl
// 参数信息: int iIndex
// 函数说明: 该方法不会将待插入的节点进行缩位处理,若打算插入的节点为非根节点,请使用AddAt(CTreeNodeUI* pControl,CTreeNodeUI* _IndexNode) 方法
//************************************
long CTreeViewUI::AddAt( CTreeNodeUI* pControl, int iIndex )
{
if (!pControl)
return -1;
if (_tcsicmp(pControl->GetClass(), _T("TreeNodeUI")) != 0)
return -1;
CTreeNodeUI* pParent = static_cast<CTreeNodeUI*>(GetItemAt(iIndex));
if(!pParent)
return -1;
pControl->OnNotify += MakeDelegate(this,&CTreeViewUI::OnDBClickItem);
pControl->GetFolderButton()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnFolderChanged);
pControl->GetCheckBox()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnCheckBoxChanged);
pControl->SetVisibleFolderBtn(m_bVisibleFolderBtn);
pControl->SetVisibleCheckBtn(m_bVisibleCheckBtn);
if(m_uItemMinWidth > 0)
pControl->SetMinWidth(m_uItemMinWidth);
CListUI::AddAt(pControl,iIndex);
if(pControl->GetCountChild() > 0)
{
int nCount = pControl->GetCountChild();
for(int nIndex = 0;nIndex < nCount;nIndex++)
{
CTreeNodeUI* pNode = pControl->GetChildNode(nIndex);
if(pNode)
return AddAt(pNode,iIndex+1);
}
}
else
return iIndex+1;
return -1;
}
示例7: OnResume
//-------------------------------------------------------
//-------------------------------------------------------
void Canvas::OnResume()
{
m_screenResizedConnection = m_screen->GetResolutionChangedEvent().OpenConnection(MakeDelegate(this, &Canvas::OnScreenResolutionChanged));
auto pointerSystem = Application::Get()->GetSystem<PointerSystem>();
m_pointerAddedConnection = pointerSystem->GetPointerAddedEvent().OpenConnection(MakeDelegate(this, &Canvas::OnPointerAdded));
m_pointerDownConnection = pointerSystem->GetPointerDownEventInternal().OpenConnection(MakeDelegate(this, &Canvas::OnPointerDown));
m_pointerMovedConnection = pointerSystem->GetPointerMovedEvent().OpenConnection(MakeDelegate(this, &Canvas::OnPointerMoved));
m_pointerUpConnection = pointerSystem->GetPointerUpEvent().OpenConnection(MakeDelegate(this, &Canvas::OnPointerUp));
m_pointerRemovedConnection = pointerSystem->GetPointerRemovedEvent().OpenConnection(MakeDelegate(this, &Canvas::OnPointerRemoved));
m_canvas->OnResume();
}
示例8: udp_params
RoadFitterInterfaceReceiver::RoadFitterInterfaceReceiver()
{
udp_params params = udp_params();
params.remote_ip = inet_addr(UDP_RF_MULTICAST_ADDR);
params.local_port = UDP_RF_PORT;
params.reuse_addr = 1;
conn = new udp_connection (params);
conn->set_callback (MakeDelegate(this,&RoadFitterInterfaceReceiver::UDPCallback),conn);
sequenceNumber=0;
packetCount=0;
dropCount=0;
printf("Road Fitter RX Interface Initialized. %s:%d\r\n",UDP_RF_MULTICAST_ADDR,UDP_RF_PORT);
}
示例9: OutputDebugString
void Process::HandleUnderlyingListingDone( ) {
m_ss.str( "" );
m_ss << "Underlying Contract Done" << std::endl;
OutputDebugString( m_ss.str().c_str() );
m_db.SetOnNewInstrumentHandler( MakeDelegate( this, &Process::HandleStrikeFromDb ) );
if ( m_db.LoadOptions( m_pUnderlying, m_dExpiry.year(), m_dExpiry.month(), m_dExpiry.day() ) ) {
// options have been loaded through HandleStrikeFromDb
HandleStrikeListingDone();
}
else {
// request contract info for strike listing
m_contract.secType = "OPT";
//m_contract.right = "CALL"; // get all calls and puts together
m_tws->SetOnContractDetailsHandler( MakeDelegate( this, &Process::HandleStrikeFromIB ) );
m_tws->SetOnContractDetailsDoneHandler( MakeDelegate( this, &Process::HandleStrikeListingDone ) );
m_tws->RequestContractDetails( m_contract );
}
m_db.SetOnNewInstrumentHandler( 0 );
}
示例10: MakeDelegate
/// Choose a player's next tech research project
TechTypes CvTechAI::ChooseNextTech(bool bFreeTech)
{
RandomNumberDelegate fcn;
TechTypes rtnValue = NO_TECH;
int iTechLoop;
// Use the synchronous random number generate
// Asynchronous one would be:
// fcn = MakeDelegate (&GC.getGame(), &CvGame::getAsyncRandNum);
fcn = MakeDelegate(&GC.getGame(), &CvGame::getJonRandNum);
// Create a new vector holding only techs we can currently research
m_ResearchableTechs.clear();
// Loop through adding the researchable techs
for(iTechLoop = 0; iTechLoop < m_pCurrentTechs->GetTechs()->GetNumTechs(); iTechLoop++)
{
if(m_pCurrentTechs->CanResearch((TechTypes)iTechLoop))
{
// For free techs, need an additional check
if(bFreeTech)
{
if(m_pCurrentTechs->CanResearchForFree((TechTypes)iTechLoop))
{
m_ResearchableTechs.push_back(iTechLoop, m_TechAIWeights.GetWeight(iTechLoop));
}
}
else
{
m_ResearchableTechs.push_back(iTechLoop, m_TechAIWeights.GetWeight(iTechLoop));
}
}
}
// Reweight our possible choices by their cost, but only if cost is actually a factor!
if(!bFreeTech)
ReweightByCost();
m_ResearchableTechs.SortItems();
LogPossibleResearch();
// If total weight is above 0, choose one above a threshold
if(m_ResearchableTechs.GetTotalWeight() > 0)
{
int iNumChoices =GC.getGame().getHandicapInfo().GetTechNumOptions();
rtnValue = (TechTypes) m_ResearchableTechs.ChooseFromTopChoices(iNumChoices, &fcn, "Choosing tech from Top Choices");
LogResearchChoice(rtnValue);
}
return rtnValue;
}
示例11: timer
void NLayout::RelayoutChilds()
{
if(!IsLayoutable())
return;
if(innerFrame_ == NULL)
return;
if(delayRelayoutChilds_)
return;
Base::NInstPtr<NTimerSrv> timer(MemToolParam);
delayRelayoutChilds_ = timer->startOnceTimer(10, MakeDelegate(this, &NLayout::RelayoutChildsImpl));
}
示例12: GetVertScroll
NScroll* NLayout::GetVertScroll()
{
if(!scrollAllowed_)
return NULL;
if(vertScroll_)
return vertScroll_;
vertScroll_.Create(MemToolParam);
vertScroll_->SetVisible(false);
vertScroll_->Create(this, _NUI_VERT_SCROLL_ID_, NFrame::LayoutVFill | NFrame::LayoutRight, NULL);
vertScroll_->SetScrollType(false);
vertScroll_->ScrollEvent.AddHandler(MakeDelegate(this, &NLayout::OnVertScrolled));
return vertScroll_;
}
示例13: MakeDelegate
void CVuChartArmsIntraDay::HandleRealTime() {
if ( theApp.m_bLive ) {
// CIQFeedSymbol *pSym;
char symIndu[] = "INDU.X";
m_IQFeedProvider.GetIQFeedProvider()->AddTradeHandler( symIndu, MakeDelegate( this, &CVuChartArmsIntraDay::ProcessMergeIndu ) );
//pSym = theApp.m_pIQFeed->Attach( symIndu );
//pSym->OnUpdateMessage.Add( MakeDelegate( this, &CVuChartArmsIntraDay::HandleInduUpdate ) );
//theApp.m_pIQFeed->Watch( symIndu );
char symTrin[] = "TRIN.Z";
m_IQFeedProvider.GetIQFeedProvider()->AddTradeHandler( symTrin, MakeDelegate( this, &CVuChartArmsIntraDay::ProcessMergeTrin ) );
//pSym = theApp.m_pIQFeed->Attach( symTrin );
//pSym->OnUpdateMessage.Add( MakeDelegate( this, &CVuChartArmsIntraDay::HandleTrinUpdate ) );
//theApp.m_pIQFeed->Watch( symTrin );
char symTick[] = "TICK.Z";
m_IQFeedProvider.GetIQFeedProvider()->AddTradeHandler( symTick, MakeDelegate( this, &CVuChartArmsIntraDay::ProcessMergeTick ) );
//pSym = theApp.m_pIQFeed->Attach( symTick );
//pSym->OnUpdateMessage.Add( MakeDelegate( this, &CVuChartArmsIntraDay::HandleTickUpdate ) );
//theApp.m_pIQFeed->Watch( symTick );
}
}
示例14: GetHorzScroll
NScroll* NLayout::GetHorzScroll()
{
if(!scrollAllowed_)
return NULL;
if(horzScroll_)
return horzScroll_;
horzScroll_.Create(MemToolParam);
horzScroll_->SetVisible(false);
horzScroll_->Create(this, _NUI_HORZ_SCROLL_ID_, NFrame::LayoutHFill | NFrame::LayoutBottom, NULL);
horzScroll_->SetScrollType(true);
horzScroll_->ScrollEvent.AddHandler(MakeDelegate(this, &NLayout::OnHorzScrolled));
return horzScroll_;
}
示例15: InputOutputWindow
QueryWindow::QueryWindow(Session *pSession,
QExplicitlySharedDataPointer<ServerConnectionPanel> pSharedServerConnPanel,
const QString &targetNick)
: InputOutputWindow(targetNick)
{
m_pSession = pSession;
m_pSharedServerConnPanel = pSharedServerConnPanel;
m_targetNick = targetNick;
m_pVLayout->addWidget(m_pOutput);
m_pVLayout->addWidget(m_pInput);
m_pVLayout->setSpacing(5);
m_pVLayout->setContentsMargins(2, 2, 2, 2);
setLayout(m_pVLayout);
m_pOpenButton = m_pSharedServerConnPanel->addOpenButton(m_pOutput, "Connect", 80, 30);
m_pOutput->installEventFilter(this);
g_pEvtManager->hookEvent("numericMessage", m_pSession, MakeDelegate(this, &QueryWindow::onNumericMessage));
g_pEvtManager->hookEvent("nickMessage", m_pSession, MakeDelegate(this, &QueryWindow::onNickMessage));
g_pEvtManager->hookEvent("noticeMessage", m_pSession, MakeDelegate(this, &QueryWindow::onNoticeMessage));
g_pEvtManager->hookEvent("privmsgMessage", m_pSession, MakeDelegate(this, &QueryWindow::onPrivmsgMessage));
}