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


C++ SingleWindow类代码示例

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


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

示例1: GetDialogStyle

void
WidgetDialog::CreatePreliminary(SingleWindow &parent, const TCHAR *caption)
{
  full = false;
  auto_size = true;
  WndForm::Create(parent, parent.GetClientRect(), caption, GetDialogStyle());
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:7,代码来源:WidgetDialog.cpp

示例2: progress

ProgressDialog::ProgressDialog(SingleWindow &parent,
                               const DialogLook &dialog_look,
                               const TCHAR *caption)
  :WndForm(parent, dialog_look, parent.GetClientRect(), caption),
   progress(GetClientAreaWindow())
{
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:7,代码来源:ProgressDialog.cpp

示例3: Create

void
WidgetDialog::CreateFull(SingleWindow &parent, const TCHAR *caption,
                         Widget *widget)
{
  Create(parent, caption, parent.GetClientRect(), widget);
  full = true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:7,代码来源:WidgetDialog.cpp

示例4: ShowPortMonitor

void
ShowPortMonitor(SingleWindow &parent, const DialogLook &dialog_look,
                const TerminalLook &terminal_look,
                DeviceDescriptor &_device)
{
  device = &_device;

  /* create the dialog */

  WindowStyle dialog_style;
  dialog_style.Hide();
  dialog_style.ControlParent();

  TCHAR buffer[64];
  StaticString<128> caption;
  caption.Format(_T("%s: %s"), _("Port monitor"),
                 device->GetConfig().GetPortName(buffer, ARRAY_SIZE(buffer)));

  dialog = new WndForm(parent, dialog_look, parent.GetClientRect(),
                       caption, dialog_style);

  ContainerWindow &client_area = dialog->GetClientAreaWindow();

  ButtonPanel buttons(client_area, dialog_look);
  buttons.Add(_("Close"), OnCloseClicked);
  buttons.Add(_("Clear"), OnClearClicked);
  buttons.Add(_("Reconnect"), OnReconnectClicked);
  buttons.Add(_("Pause"), OnPauseClicked);

  const PixelRect rc = buttons.UpdateLayout();

  /* create the terminal */

  terminal = new TerminalWindow(terminal_look);
  terminal->set(dialog->GetClientAreaWindow(), rc.left, rc.top,
                rc.right - rc.left, rc.bottom - rc.top);

  bridge = new PortTerminalBridge(*terminal);
  device->SetMonitor(bridge);
  paused = false;

  /* run it */

  dialog->ShowModal();

  device->SetMonitor(NULL);
  delete bridge;
  delete terminal;
  delete dialog;
}
开发者ID:aharrison24,项目名称:XCSoar,代码行数:50,代码来源:PortMonitor.cpp

示例5: JobDialog

bool
JobDialog(SingleWindow &parent, const DialogLook &dialog_look,
          const TCHAR *caption,
          Job &job, bool cancellable)
{
  WindowStyle form_style;
  form_style.Hide();
  WndForm form(parent, dialog_look,
               parent.GetClientRect(),
               caption);

  ContainerWindow &client_area = form.GetClientAreaWindow();

  ProgressWindowOperation progress(client_area);
  DialogJobThread thread(progress, job, form);
  thread.Start();

  JobCancelButton cancel_button(thread);
  if (cancellable) {
    ButtonWindowStyle style;
    style.TabStop();

    PixelRect rc = client_area.GetClientRect();
    rc.right -= Layout::Scale(2);
    rc.left = rc.right - Layout::Scale(78);
    rc.top += Layout::Scale(2);
    rc.bottom = rc.top + Layout::Scale(35);
    cancel_button.set(client_area, _("Cancel"), rc,
                      style);
    cancel_button.SetFont(*dialog_look.button.font);
    cancel_button.BringToTop();
  }

  int result = form.ShowModal();

  thread.Cancel();
  thread.Join();

  return result == mrOK;
}
开发者ID:aharrison24,项目名称:XCSoar,代码行数:40,代码来源:JobDialog.cpp

示例6: button_style

void
TaskManagerDialog::Create(SingleWindow &parent)
{
  WndForm::Create(parent, parent.GetClientRect(), _("Task Manager"));

  task = protected_task_manager->TaskClone();

  /* create the controls */

  ContainerWindow &client_area = GetClientAreaWindow();
  const TaskManagerLayout layout =
    CalculateTaskManagerLayout(client_area.GetClientRect());

  task_view_position = layout.task_view;

  WindowStyle hidden;
  hidden.Hide();
  task_view = new TaskMapWindow(UIGlobals::GetMapLook(), *this, MAP);
  task_view->Create(client_area, layout.task_view, hidden);

  ButtonWindowStyle button_style(hidden);
  button_style.TabStop();
  target_button = new WndButton(client_area, GetLook(), _("Target"),
                                layout.target_button, button_style,
                                *this, TARGET);

  WindowStyle tab_style;
  tab_style.ControlParent();
  tab_bar = new TabBarControl(client_area, GetLook(), layout.tab_bar,
                              tab_style, layout.vertical);
  tab_bar->SetPageFlippedCallback([this]() { UpdateCaption(); });

  /* create pages */

  TaskPropertiesPanel *wProps =
    new TaskPropertiesPanel(*this, &task, &modified);

  TaskClosePanel *wClose = new TaskClosePanel(*this, &modified);

  TaskCalculatorPanel *wCalculator =
    new TaskCalculatorPanel(UIGlobals::GetDialogLook(), &modified);
  wCalculator->SetTargetButton(target_button);

  const MapLook &look = UIGlobals::GetMapLook();
  Widget *wEdit = CreateTaskEditPanel(*this, look.task, look.airspace,
                                      &task, &modified);

  TaskMiscPanel *list_tab = new TaskMiscPanel(*this, &task, &modified);

  const bool enable_icons =
    CommonInterface::GetUISettings().dialog.tab_style
    == DialogSettings::TabStyle::Icon;
  const IconLook &icons = UIGlobals::GetIconLook();
  const Bitmap *CalcIcon = enable_icons ? &icons.hBmpTabCalculator : NULL;
  const Bitmap *TurnPointIcon = enable_icons ? &icons.hBmpTabTask : NULL;
  const Bitmap *BrowseIcon = enable_icons ? &icons.hBmpTabWrench : NULL;
  const Bitmap *PropertiesIcon = enable_icons ? &icons.hBmpTabSettings : NULL;

  tab_bar->AddTab(wCalculator, _("Calculator"), CalcIcon);

  if (layout.vertical) {
    tab_bar->AddTab(wEdit, _("Turn Points"), TurnPointIcon);
    TurnpointTab = 1;

    tab_bar->AddTab(list_tab, _("Manage"), BrowseIcon);

    tab_bar->AddTab(wProps, _("Rules"), PropertiesIcon);
    PropertiesTab = 3;

    tab_bar->AddTab(wClose, _("Close"));

    tab_bar->SetCurrentPage(0);
  } else {
    tab_bar->AddTab(wClose, _("Close"));

    tab_bar->AddTab(wEdit, _("Turn Points"), TurnPointIcon);
    TurnpointTab = 2;

    tab_bar->AddTab(list_tab, _("Manage"), BrowseIcon);

    tab_bar->AddTab(wProps, _("Rules"), PropertiesIcon);
    PropertiesTab = 4;

    tab_bar->SetCurrentPage(0);
  }

  UpdateCaption();
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:88,代码来源:TaskManagerDialog.cpp

示例7: dlgQuickMenuShowModal

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

示例8: dlgConfigInfoboxesShowModal

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

示例9: Create

void
WndForm::Create(SingleWindow &main_window,
                const TCHAR *_caption, const WindowStyle style)
{
  Create(main_window, main_window.GetClientRect(), _caption, style);
}
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:6,代码来源:Form.cpp

示例10: GetDialogStyle

void
WidgetDialog::CreatePreliminary(SingleWindow &parent, const TCHAR *caption)
{
  WndForm::Create(parent, parent.GetClientRect(), caption, GetDialogStyle());
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:5,代码来源:WidgetDialog.cpp

示例11: dlgConfigInfoboxesShowModal

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

  PixelRect rc = parent.GetClientRect();
  wf = new WndForm(parent, dialog_look, rc);

#ifdef _WIN32_WCE
  if (IsAltair())
    wf->SetKeyDownFunction(OnKeyDown);
#endif

  ContainerWindow &client_area = wf->GetClientAreaWindow();
  rc = client_area.GetClientRect();
  rc.Grow(Layout::FastScale(-2));
  info_box_layout = InfoBoxLayout::Calculate(rc, geometry);

  WindowStyle preview_style;
  preview_style.EnableDoubleClicks();
  for (unsigned i = 0; i < info_box_layout.count; ++i) {
    rc = info_box_layout.positions[i];
    previews[i].Create(client_area, rc, preview_style);
  }

  rc = info_box_layout.remaining;

  WindowStyle style;
  style.TabStop();

  PixelRect control_rc = rc;
  control_rc.right -= Layout::FastScale(2);

  const UPixelScalar height = Layout::Scale(22);
  const UPixelScalar caption_width = Layout::Scale(60);

  ButtonWindowStyle button_style;
  button_style.TabStop();

  control_rc.bottom = control_rc.top + height;
  edit_name = new WndProperty(client_area, dialog_look, _("Name"),
                              control_rc, caption_width,
                              style);
  DataFieldString *dfs = new DataFieldString(allow_name_change
                                             ? (const TCHAR *)data.name
                                             : gettext(data.name));
  edit_name->SetDataField(dfs);
  edit_name->SetReadOnly(!allow_name_change);

  control_rc.top = control_rc.bottom;
  control_rc.bottom = control_rc.top + height;

  edit_select = new WndProperty(client_area, dialog_look, _("InfoBox"),
                                control_rc, caption_width,
                                style);

  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);

  control_rc.top += height;
  control_rc.bottom += height;

  edit_content = new WndProperty(client_area, dialog_look, _("Content"),
                                 control_rc, caption_width,
                                 style);

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

  dfe->EnableItemHelp(true);
  dfe->Sort(0);

  edit_content->SetDataField(dfe);

  control_rc.top += height;
  control_rc.bottom += height * 5;
  edit_content_description = new WndFrame(client_area, dialog_look,
                                          control_rc, style);

  RefreshEditContent();

  const UPixelScalar button_width = Layout::Scale(60);
//.........这里部分代码省略.........
开发者ID:Adrien81,项目名称:XCSoar,代码行数:101,代码来源:dlgConfigInfoboxes.cpp

示例12: args

int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#ifdef _WIN32_WCE
        LPWSTR lpCmdLine,
#else
        LPSTR lpCmdLine2,
#endif
        int nCmdShow)
#endif
{
#ifdef ENABLE_CMDLINE
#ifdef WIN32
  Args args(GetCommandLine(), USAGE);
#else
  Args args(argc, argv, USAGE);
#endif
  ParseCommandLine(args);
  args.ExpectEnd();
#endif

#if defined(ENABLE_RESOURCE_LOADER) && defined(USE_GDI)
  ResourceLoader::Init(hInstance);
#endif

#ifdef ENABLE_SCREEN
  ScreenGlobalInit screen_init;
  Layout::Initialize(640, 480);
  InitialiseFonts();
#endif

#ifdef ENABLE_DIALOG
  dialog_settings.SetDefaults();
#endif

#ifdef ENABLE_LOOK
  look = new Look();
  look->Initialise(normal_font, bold_font, small_font);

  {
    UISettings ui_settings;
    ui_settings.SetDefaults();
    look->InitialiseConfigured(ui_settings,
                               normal_font, bold_font, small_font,
                               small_font, monospace_font,
                               normal_font, small_font,
#ifndef GNAV
                               small_font,
#endif
                               small_font);
  }

  dialog_look = &look->dialog;
#elif defined(ENABLE_DIALOG_LOOK)
  dialog_look = new DialogLook();
  dialog_look->Initialise(bold_font, normal_font, small_font,
                          bold_font, bold_font, bold_font);
#endif

#ifdef ENABLE_XML_DIALOG
  SetXMLDialogLook(*dialog_look);
#endif

#ifdef ENABLE_DATA_PATH
  InitialiseDataPath();
#endif

#ifdef ENABLE_PROFILE
  Profile::SetFiles(_T(""));
  Profile::Load();
#endif

#ifdef ENABLE_MAIN_WINDOW
  main_window.Create(_T("Test"), {640, 480});
  main_window.Show();
#endif

  Main();

#ifdef ENABLE_MAIN_WINDOW
  main_window.Destroy();
#endif

#ifdef ENABLE_DATA_PATH
  DeinitialiseDataPath();
#endif

#ifdef ENABLE_LOOK
  delete look;
#elif defined(ENABLE_DIALOG_LOOK)
  delete dialog_look;
#endif

#ifdef ENABLE_SCREEN
  DeinitialiseFonts();
#endif

  return 0;
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:98,代码来源:Main.hpp


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