• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cWindow类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cWindow的典型用法代码示例。如果您正苦于以下问题:C++ cWindow类的具体用法?C++ cWindow怎么用?C++ cWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了cWindow类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

void cProtocol132::SendWholeInventory(const cWindow & a_Window)
{
	// 1.3.2 requires player inventory slots to be sent as SetSlot packets, 
	// otherwise it sometimes fails to update the window
	
	// Send the entire window:
	super::SendWholeInventory(a_Window);
	
	// Send the player inventory and hotbar:
	cPlayer * Player = m_Client->GetPlayer();
	const cInventory & Inventory = Player->GetInventory();
	int BaseOffset = a_Window.GetNumSlots() - (cInventory::invNumSlots - cInventory::invInventoryOffset);  // Number of non-inventory slots
	char WindowID = a_Window.GetWindowID();
	for (short i = 0; i < cInventory::invInventoryCount; i++)
	{
		SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetInventorySlot(i));
	}  // for i - Inventory[]
	BaseOffset += cInventory::invInventoryCount;
	for (short i = 0; i < cInventory::invHotbarCount; i++)
	{
		SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetHotbarSlot(i));
	}  // for i - Hotbar[]
	
	// Send even the item being dragged:
	SendInventorySlot(-1, -1, Player->GetDraggingItem());
}
开发者ID:wang108,项目名称:MCServer,代码行数:26,代码来源:Protocol132.cpp


示例2: Lock

void cProtocol125::SendWholeInventory(const cWindow & a_Window)
{
	cCSLock Lock(m_CSPacket);
	cItems Slots;
	a_Window.GetSlots(*(m_Client->GetPlayer()), Slots);
	SendWindowSlots(a_Window.GetWindowID(), (int)Slots.size(), &(Slots[0]));
}
开发者ID:FX-Master,项目名称:MCServer,代码行数:7,代码来源:Protocol125.cpp


示例3: Create

  void cLinkControl::Create(cWindow& parent, cLinkControlListener& listener, int idControl, const string_t& sText)
  {
    // Create the SysLink control
    control = ::CreateWindowEx(NULL, WC_LINK, sText.c_str(),
      WS_VISIBLE | WS_CHILD | WS_TABSTOP,
      50, 220, 100, 24,
      parent.GetWindowHandle(),
      (HMENU)NULL,
      ::GetModuleHandle(NULL), NULL
    );

    // Set the default font
    parent.SetControlDefaultFont(control);

    parent.AddHandler(control, *this);

    pListener = &listener;
  }
开发者ID:pilkch,项目名称:library,代码行数:18,代码来源:controls.cpp


示例4: Init

  void cTaskBar::Init(cWindow& owner)
  {
    std::cout<<"LTaskbarButton::Init"<<std::endl;

    ASSERT(hwndWindow == NULL);
    hwndWindow = owner.GetWindowHandle();

    ASSERT(!taskBarList.IsValid());
    taskBarList.CreateObject((REFCLSID)CLSID_TaskbarList, IID_ITaskbarList3);
    ASSERT(taskBarList.IsValid());
  }
开发者ID:pilkch,项目名称:library,代码行数:11,代码来源:taskbar.cpp


示例5: OpenWebPage

  void OpenWebPage(const cWindow& parent, const string_t& sWebPage)
  {
    // Launch this web page in the default browser
    SHELLEXECUTEINFO sh;
    memset(&sh, 0, sizeof(SHELLEXECUTEINFO));

    sh.cbSize = sizeof(SHELLEXECUTEINFO);
    sh.lpVerb = TEXT("open");
    sh.lpFile = sWebPage.c_str();
    sh.hwnd = parent.GetWindowHandle();
    sh.nShow = SW_NORMAL;

    ::ShellExecuteEx(&sh);
  }
开发者ID:pilkch,项目名称:library,代码行数:14,代码来源:libwin32mm.cpp


示例6: Create

  void cOpenGLControl::Create(cWindow& parent, int idControl)
  {
    // Register our window class
    RegisterClass();

    // Create the OpenGL control
    control = ::CreateWindowEx(0, TEXT(LIBWIN32MM_OPENGL_CONTROLCLASS), TEXT(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, parent.GetWindowHandle(), (HMENU)idControl, GetHInstance(), (LPVOID)0);

    parent.SetControlDefaultFont(control);

    UpdateSize();

    // Set our user data for this window
    ::SetProp(control, TEXT("cOpenGLControlThis"), (HANDLE)this);
  }
开发者ID:pilkch,项目名称:library,代码行数:15,代码来源:openglcontrol.cpp


示例7: _RenderWindow

    void cWindowManager::_RenderWindow(const cWindow& widget) const
    {
      const float title_bar_height = widget.GetTitleBarHeight();

      // Draw the top bar
      SetColourFromThemeColourAndAlpha(theme.GetColourWindowTitleBar());
      _RenderRectangle(widget.GetX(), widget.GetY(), widget.GetWidth(), title_bar_height);

      // Draw the rest of the window
      SetColourFromThemeColourAndAlpha(theme.GetColourWindowBackground());
      _RenderRectangle(widget.GetX(), widget.GetY() + title_bar_height, widget.GetWidth(), widget.GetHeight() - title_bar_height);

#if 0
      // Draw the caption if this window has one
      if (widget.HasCaption()) {
        /*glPushAttrib(GL_LIST_BIT | GL_CURRENT_BIT  | GL_ENABLE_BIT);
          {
            render::ApplyMaterial apply(pMaterial);

            pContext->SelectTextureUnit0();

            glMatrixMode(GL_TEXTURE);
            glPushMatrix();
              glLoadIdentity();

              glMatrixMode(GL_MODELVIEW);

              glColor4f(0.0f, 0.0f, 0.0f, 1.0f);*/

              //pFontWindowCaption->printfCenteredHorizontallyVertically(widget.GetX(), widget.GetY(),
              //  widget.GetWidth(), bar_height,
              //  breathe::string::ToUTF8(widget.GetCaption()).c_str());
              pFontWindowCaption->PrintCenteredHorizontally(widget.GetX(), widget.GetY(),
                widget.GetWidth(), widget.GetCaption());

              //glMatrixMode(GL_TEXTURE);
            //glPopMatrix();
          //}
        //glPopAttrib();
      }
#endif
    }
开发者ID:pilkch,项目名称:library,代码行数:42,代码来源:cWindowManager.cpp


示例8: Run

  int cTaskDialog::Run(cWindow& parent, const cTaskDialogSettings& settings)
  {
    // Create our task dialog
    TASKDIALOGCONFIG tdc = { 0 };
    tdc.cbSize = sizeof(tdc);
    tdc.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION;
    if (settings.bIsCheckBoxTickedInitially) tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
    tdc.dwCommonButtons = (settings.bCloseButtonText ? TDCBF_CLOSE_BUTTON : TDCBF_CANCEL_BUTTON);
    tdc.hwndParent = parent.GetWindowHandle();
    tdc.hInstance = GetHInstance();

    //tdc.hMainIcon = hIcon;

    switch (settings.type) {
      case cTaskDialogSettings::TYPE::INFORMATION: {
        tdc.pszMainIcon = TD_INFORMATION_ICON;
        break;
      }
      case cTaskDialogSettings::TYPE::WARNING: {
        tdc.pszMainIcon = TD_ERROR_ICON;
        break;
      }
      case cTaskDialogSettings::TYPE::ERROR: {
        tdc.pszMainIcon = TD_ERROR_ICON;
        break;
      }
    };

    tdc.pszWindowTitle = settings.sCaption.c_str();
    tdc.pszMainInstruction = settings.sInstructions.c_str();
    tdc.pszContent = settings.sContent.c_str();

    // Add our buttons
    TASKDIALOG_BUTTON* pButtons = nullptr;
    const size_t nButtons = settings.items.size();
    if (!settings.items.empty()) {
      tdc.dwFlags |= TDF_USE_COMMAND_LINKS;

      pButtons = new TASKDIALOG_BUTTON[nButtons];
      for (size_t i = 0; i < nButtons; i++) {
        pButtons[i].nButtonID = settings.items[i].iCommandID;
        string_t sText(settings.items[i].sText);
        if (!settings.items[i].sTextDescription.empty()) {
          sText += TEXT("\n");
          sText += settings.items[i].sTextDescription;
        }

        const size_t nSize = sText.length() + 1;
        pButtons[i].pszButtonText = new wchar_t[nSize];
        wcscpy_s((wchar_t*)(pButtons[i].pszButtonText), nSize, sText.c_str());
      }

      tdc.pButtons = pButtons;
      tdc.cButtons = UINT(nButtons);

      tdc.nDefaultButton = settings.iDefaultItemCommandID;
    }

    /*PCWSTR      pszExpandedInformation;
    PCWSTR      pszExpandedControlText;
    PCWSTR      pszCollapsedControlText;*/

    tdc.pfCallback = _TaskDialogCallbackProc;
    tdc.lpCallbackData = LONG_PTR(this);

    if (settings.bIsProgressBarVisible) {
      tdc.dwFlags |= TDF_CALLBACK_TIMER | TDF_SHOW_PROGRESS_BAR;
    }

    // Checkbox
    if (settings.bIsCheckBoxVisible) {
      tdc.dwFlags |= TDF_EXPAND_FOOTER_AREA;
      tdc.pszVerificationText = settings.sCheckBoxTitle.c_str();
    }

    // Run the task dialog
    int iButton = 0;
    //BOOL bResult = FALSE;
    const HRESULT rResult = TaskDialogIndirect(&tdc, &iButton, NULL, nullptr /*&bResult*/);
    assert(rResult == S_OK);

    // Clear our window handle
    hwndWindow = NULL;

    // Destroy our buttons
    if (pButtons != nullptr) {
      for (size_t i = 0; i < nButtons; i++) delete [] pButtons[i].pszButtonText;
      delete [] pButtons;
    }

    // If there was an error then pretend the user cancelled
    if (rResult != S_OK) iButton = IDCANCEL;
    
    // If no valid selection was made then pretend the user cancelled
    if (iButton < 0) iButton = IDCANCEL;

    // Return the button that was selected
    return iButton;
  }
开发者ID:pilkch,项目名称:library,代码行数:99,代码来源:taskdialog.cpp



注:本文中的cWindow类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cWindowManager类代码示例发布时间:2022-05-31
下一篇:
C++ cVector3d类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap