当前位置: 首页>>代码示例>>C++>>正文


C++ SingleWindow::get_client_rect方法代码示例

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


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

示例1: WndCustomButton

void
dlgQuickMenuShowModal(SingleWindow &parent)
{
  const Menu *menu = InputEvents::GetMenu(_T("RemoteStick"));
  if (menu == NULL)
    return;

  const DialogLook &dialog_look = UIGlobals::GetDialogLook();

  WindowStyle dialogStyle;
  dialogStyle.Hide();
  dialogStyle.ControlParent();

  wf = new WndForm(parent, dialog_look, parent.get_client_rect(),
                   _T("Quick Menu"), dialogStyle);

  ContainerWindow &client_area = wf->GetClientAreaWindow();

  PixelRect r = client_area.get_client_rect();

  WindowStyle grid_view_style;
  grid_view_style.ControlParent();

  grid_view = new GridView(client_area,
                           r.left, r.top,
                           r.right - r.left, r.bottom - r.top,
                           dialog_look, grid_view_style);

  WindowStyle buttonStyle;
  buttonStyle.TabStop();

  for (unsigned i = 0; i < menu->MAX_ITEMS; ++i) {
    if (buttons.full())
      continue;

    const MenuItem &menuItem = (*menu)[i];
    if (!menuItem.IsDefined())
      continue;

    TCHAR buffer[100];
    ButtonLabel::Expanded expanded =
      ButtonLabel::Expand(menuItem.label, buffer, ARRAY_SIZE(buffer));
    if (!expanded.visible)
      continue;

    PixelRect button_rc;
    button_rc.left = 0;
    button_rc.top = 0;
    button_rc.right = 80;
    button_rc.bottom = 30;
    WndButton *button =
      new WndCustomButton(*grid_view, dialog_look, expanded.text,
                          button_rc, buttonStyle, OnButtonClicked);
    button->set_enabled(expanded.enabled);

    buttons.append(button);
    events.append(menuItem.event);
  }

  grid_view->SetItems(buttons);
  SetFormDefaultFocus();
  SetFormCaption();

  wf->SetKeyDownNotify(FormKeyDown);

  wf->ShowModal();

  for (auto it = buttons.begin(), end = buttons.end(); it != end; ++it)
    delete *it;

  buttons.clear();
  events.clear();

  delete wf;
  delete grid_view;
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:76,代码来源:dlgQuickMenu.cpp

示例2: WndButton

bool
dlgConfigInfoboxesShowModal(SingleWindow &parent,
                            const DialogLook &dialog_look,
                            InfoBoxLayout::Geometry geometry,
                            InfoBoxSettings::Panel &data_r,
                            bool allow_name_change)
{
  current_preview = 0;
  data = data_r;

  PixelRect rc = parent.get_client_rect();
  wf = new WndForm(parent, dialog_look, rc.left, rc.top,
                   rc.right - rc.left, rc.bottom - rc.top);

#ifdef _WIN32_WCE
  if (is_altair())
    wf->SetKeyDownNotify(OnKeyDown);
#endif

  ContainerWindow &client_area = wf->GetClientAreaWindow();
  rc = client_area.get_client_rect();

  InflateRect(&rc, Layout::FastScale(-2), Layout::FastScale(-2));
  info_box_layout = InfoBoxLayout::Calculate(rc, geometry);

  WindowStyle preview_style;
  preview_style.enable_double_clicks();
  for (unsigned i = 0; i < info_box_layout.count; ++i) {
    rc = info_box_layout.positions[i];
    previews[i].set(client_area, rc.left, rc.top,
                    rc.right - rc.left, rc.bottom - rc.top,
                    preview_style);
  }

  rc = info_box_layout.remaining;

  WindowStyle style;
  style.control_parent();

  EditWindowStyle edit_style;
  edit_style.tab_stop();

  if (is_embedded() || Layout::scale_1024 < 2048)
    /* sunken edge doesn't fit well on the tiny screen of an
       embedded device */
    edit_style.border();
  else
    edit_style.sunken_edge();

  const int x = rc.left;
  const unsigned width = rc.right - rc.left - Layout::FastScale(2);
  const unsigned height = Layout::Scale(22);
  const unsigned caption_width = Layout::Scale(60);

  int y = rc.top;

  ButtonWindowStyle button_style;
  button_style.tab_stop();

  buttonPanelName =
    new WndButton(client_area, dialog_look, _T(""),
                  x, y, width, height, button_style, OnNameAccess);
  buttonPanelName->set_enabled(allow_name_change);
  UpdatePanelName();

  y += height;

  edit_select = new WndProperty(client_area, dialog_look, _("InfoBox"),
                                x, y, width, height, caption_width,
                                style, edit_style,
                                NULL);

  DataFieldEnum *dfe = new DataFieldEnum(OnSelectAccess);
  for (unsigned i = 0; i < info_box_layout.count; ++i) {
    TCHAR label[32];
    _stprintf(label, _T("%u"), i + 1);
    dfe->addEnumText(label, i);
  }

  edit_select->SetDataField(dfe);

  y += height;

  edit_content = new WndProperty(client_area, dialog_look, _("Content"),
                                 x, y, width, height, caption_width,
                                 style, edit_style,
                                 NULL);

  dfe = new DataFieldEnum(OnContentAccess);
  for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; ++i) {
    const TCHAR *name = InfoBoxFactory::GetName(i);
    if (name != NULL)
      dfe->addEnumText(gettext(name), i);
  }

  dfe->Sort(0);

  edit_content->SetDataField(dfe);
  edit_content->SetOnHelpCallback(OnContentHelp);

//.........这里部分代码省略.........
开发者ID:macsux,项目名称:XCSoar,代码行数:101,代码来源:dlgConfigInfoboxes.cpp


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