Пример #1
0
wxDialog *wxGenericFileButton::CreateDialog()
{
    wxFileDialog* const dialog = new wxFileDialog
                                     (
                                        GetDialogParent(),
                                        m_message,
                                        wxEmptyString,
                                        wxEmptyString,
                                        m_wildcard,
                                        GetDialogStyle()
                                     );

    // If there is no default file or if it doesn't have any path, use the
    // explicitly set initial directory.
    //
    // Notice that it is important to call this before SetPath() below as if we
    // do have m_initialDir and no directory in m_path, we need to interpret
    // the path as being relative with respect to m_initialDir.
    if ( !m_initialDir.empty() )
        DoSetInitialDirectory(dialog, m_initialDir);

    // This sets both the default file name and the default directory of the
    // dialog if m_path contains directory part.
    dialog->SetPath(m_path);

    return dialog;
}
Пример #2
0
void
WidgetDialog::CreatePreliminary(SingleWindow &parent, const TCHAR *caption)
{
  full = false;
  auto_size = true;
  WndForm::Create(parent, parent.GetClientRect(), caption, GetDialogStyle());
}
Пример #3
0
void
WidgetDialog::CreateAuto(SingleWindow &parent, const TCHAR *caption,
                         Widget *_widget)
{
  auto_size = true;
  WndForm::Create(parent, caption, GetDialogStyle());
  widget.Set(_widget);
  widget.Move(buttons.UpdateLayout());
}
Пример #4
0
void
WidgetDialog::Create(SingleWindow &parent,
                     const TCHAR *caption, const PixelRect &rc,
                     Widget *_widget)
{
  auto_size = false;
  WndForm::Create(parent, rc, caption, GetDialogStyle());
  widget.Set(_widget);
  widget.Move(buttons.UpdateLayout());
}
Пример #5
0
wxDialog *wxGenericDirButton::CreateDialog()
{
    wxDirDialog* const dialog = new wxDirDialog
                                    (
                                        GetDialogParent(),
                                        m_message,
                                        m_path.empty() ? m_initialDir : m_path,
                                        GetDialogStyle()
                                    );
    return dialog;
}
Пример #6
0
/**
 * This function returns a WndForm created either from the ressources or
 * from the XML file in XCSoarData(if found)
 * @param LookUpTable The CallBackTable
 * @param FileName The XML filename to search for in XCSoarData
 * @param Parent The parent window (e.g. XCSoarInterface::main_window)
 * @param resource The resource to look for
 * @return The WndForm object
 */
WndForm *
LoadDialog(CallBackTableEntry *LookUpTable, SingleWindow &Parent,
               const TCHAR* resource)
{
  WndForm *form = NULL;

  // Find XML file or resource and load XML data out of it
  XMLNode node = xmlOpenResourceHelper(resource);

  // TODO code: put in error checking here and get rid of exits in xmlParser
  // If XML error occurred -> Error messagebox + cancel
  if (node.isEmpty()) {
    ShowXMLError();
    return NULL;
  }

  // If the main XMLNode is of type "Form"
  if (_tcsicmp(node.getName(), _T("Form")) != 0)
    // Get the first child node of the type "Form"
    // and save it as the dialog node
    node = node.getChildNode(_T("Form"));

  // If Node does not exists -> Error messagebox + cancel
  if (node.isEmpty()) {
    ShowXMLError();
    return NULL;
  }

  // Determine the dialog style of the dialog
  DialogStyle dialog_style = GetDialogStyle(node);

  // Determine the dialog size
  const TCHAR* Caption = GetCaption(node);
  const RECT rc = Parent.get_client_rect();
  ControlPosition pos = GetPosition(node, rc);
  ControlSize size = GetSize(node, rc, pos);

  InitScaleWidth(size, rc, dialog_style);

  // Correct dialog size and position for dialog style
  switch (dialog_style) {
  case dsFullWidth:
    pos.x = rc.left;
    pos.y = rc.top;
    size.cx = rc.right - rc.left; // stretch form to full width of screen
    size.cy = rc.bottom - rc.top;
    break;
  case dsScaledCentered:
    pos = SetPositionCentered(pos, rc, size);
    break;

  case dsScaled:
  case dsFixed:
    break;
  }

  // Create the dialog
  WindowStyle style;
  style.hide();
  style.control_parent();

  form = new WndForm(Parent, pos.x, pos.y, size.cx, size.cy, Caption, style);

  // Set fore- and background colors
  Color color;
  if (StringToColor(node.getAttribute(_T("BackColor")), color))
    form->SetBackColor(color);

  // Load the children controls
  LoadChildrenFromXML(*form, form->GetClientAreaWindow(), form->GetBackColor(),
                      LookUpTable, &node, dialog_style);

  // If XML error occurred -> Error messagebox + cancel
  if (XMLNode::GlobalError) {
    ShowXMLError();
    delete form;
    return NULL;
  }

  // Return the created form
  return form;
}
Пример #7
0
void
WidgetDialog::CreatePreliminary(SingleWindow &parent, const TCHAR *caption)
{
  WndForm::Create(parent, parent.GetClientRect(), caption, GetDialogStyle());
}