Пример #1
0
/**
 * Move button to the specified left and top coordinates.
 *
 * The coordinates SHOULD BE in pixels of the screen (i.e. after scaling!)
 *
 * @param ch
 * @param left    Number of pixels from the left (in screen pixels)
 * @param top     Number of pixels from the top (in screen pixels)
 */
void
KeyboardControl::move_button(TCHAR ch, int left, int top)
{
  ButtonWindow *kb = get_button(ch);
  if (kb)
    kb->move(left, top);
}
Пример #2
0
/**
 * Move button to the specified left and top coordinates.
 *
 * The coordinates SHOULD BE in pixels of the screen (i.e. after scaling!)
 *
 * @param ch
 * @param left    Number of pixels from the left (in screen pixels)
 * @param top     Number of pixels from the top (in screen pixels)
 */
void
KeyboardControl::move_button(TCHAR ch, PixelScalar left, PixelScalar top)
{
  ButtonWindow *kb = get_button(ch);
  if (kb)
    kb->Move(left, top);
}
Пример #3
0
/**
 * Move button to the specified left and top coordinates.
 *
 * The coordinates SHOULD BE in pixels of the screen (i.e. after scaling!)
 *
 * @param ch
 * @param left    Number of pixels from the left (in screen pixels)
 * @param top     Number of pixels from the top (in screen pixels)
 */
void
KeyboardWidget::MoveButton(unsigned ch, PixelScalar left, PixelScalar top)
{
  ButtonWindow *kb = FindButton(ch);
  if (kb)
    kb->Move(left, top);
}
Пример #4
0
/**
 * Resizes the button to specified width and height values according to display pixels!
 *
 *
 * @param ch
 * @param width   Width measured in display pixels!
 * @param height  Height measured in display pixels!
 */
void
KeyboardWidget::ResizeButton(unsigned ch,
                              UPixelScalar width, UPixelScalar height)
{
  ButtonWindow *kb = FindButton(ch);
  if (kb)
    kb->Resize(width, height);
}
Пример #5
0
/**
 * Resizes the button to specified width and height values according to display pixels!
 *
 *
 * @param ch
 * @param width   Width measured in display pixels!
 * @param height  Height measured in display pixels!
 */
void
KeyboardControl::resize_button(TCHAR ch,
                               UPixelScalar width, UPixelScalar height)
{
  ButtonWindow *kb = get_button(ch);
  if (kb)
    kb->Resize(width, height);
}
Пример #6
0
/**
 * Resizes the button to specified width and height values according to display pixels!
 *
 *
 * @param ch
 * @param width   Width measured in display pixels!
 * @param height  Height measured in display pixels!
 */
void
KeyboardControl::resize_button(TCHAR ch,
                               unsigned int width, unsigned int height)
{
  ButtonWindow *kb = get_button(ch);
  if (kb)
    kb->resize(width, height);
}
Пример #7
0
  void OnResize(PixelSize size) override {
    SingleWindow::OnResize(size);

    const PixelRect rc = GetClientRect();
    if (test_window.IsDefined())
      test_window.Move(rc);

    if (close_button.IsDefined())
      close_button.Move(GetButtonRect(rc));
  }
Пример #8
0
int main(int argc, char **argv)
{
  QApplication app(argc,argv);
  ButtonWindow *window = new ButtonWindow();

  app.setMainWidget(window);
  window->show();

  return app.exec();
}
Пример #9
0
void
KeyboardControl::add_button(const TCHAR* caption)
{
  assert(num_buttons < MAX_BUTTONS);

  button_values[num_buttons] = caption[0];
  ButtonWindow *button = &buttons[num_buttons++];
  button->set(*this, caption, (unsigned)caption[0],
              0, 0, button_width, button_height);
  button->set_font(Fonts::MapBold);
}
Пример #10
0
void
KeyboardControl::move_buttons_to_row(const TCHAR* buttons, int row, int offset)
{
  if (string_is_empty(buttons))
    return;

  ButtonWindow *kb;
  for (unsigned i = 0; i < _tcslen(buttons); i++) {
    kb = get_button(buttons[i]);
    if (!kb)
      continue;

    kb->move(i * button_width + offset, row * button_height);
  }
}
Пример #11
0
  void set(const DialogLook &look,
           int left, int top, unsigned width, unsigned height) {
    SingleWindow::set(_T("RunRenderOZ"), _T("RunRenderOZ"),
                      left, top, width, height);

    const PixelRect rc = get_client_rect();

    WindowStyle with_border;
    with_border.border();

    oz.set(*this, rc.right / 2, 0, rc.right - (rc.right / 2), rc.bottom,
           with_border);
    oz_window = &oz;

    type_list = new WndListFrame(*this, look,
                                 0, 0, rc.right / 2, rc.bottom - 30,
                                 with_border, 25);
    type_list->SetPaintItemCallback(paint_oz_type_name);
    type_list->SetCursorCallback(oz_type_cursor_callback);
    type_list->SetLength(NUM_OZ_TYPES);

    close_button.set(*this, _T("Close"), ID_CLOSE,
                     0, rc.bottom - 30, rc.right / 2, 30);

    oz.set_shape(ObservationZonePoint::LINE);

    type_list->set_focus();
  }
Пример #12
0
  void set(const DialogLook &look, PixelRect _rc) {
    SingleWindow::set(_T("RunRenderOZ"), _T("RunRenderOZ"), _rc);

    const PixelRect rc = get_client_rect();

    WindowStyle with_border;
    with_border.Border();

    oz.set(*this, rc.right / 2, 0, rc.right - (rc.right / 2), rc.bottom,
           with_border);
    oz_window = &oz;

    const PixelRect list_rc = {
      0, 0, PixelScalar(rc.right / 2), PixelScalar(rc.bottom - 30),
    };

    type_list = new ListControl(*this, look, list_rc,
                                with_border, 25);
    type_list->SetPaintItemCallback(paint_oz_type_name);
    type_list->SetCursorCallback(oz_type_cursor_callback);
    type_list->SetLength(NUM_OZ_TYPES);

    PixelRect button_rc = rc;
    button_rc.right = (rc.left + rc.right) / 2;
    button_rc.top = button_rc.bottom - 30;
    close_button.set(*this, _T("Close"), ID_CLOSE, button_rc);

    oz.set_shape(ObservationZonePoint::LINE);

    type_list->SetFocus();
  }
Пример #13
0
    void Create(const DialogLook &look, PixelSize size) {
        SingleWindow::Create(_T("RunRenderOZ"), size);

        const PixelRect rc = GetClientRect();

        WindowStyle with_border;
        with_border.Border();

        PixelRect oz_rc = rc;
        oz_rc.left = oz_rc.right / 2;
        oz.Create(*this, oz_rc, with_border);

        const PixelRect list_rc(0, 0, rc.right / 2, rc.bottom - 30);

        type_list = new ListControl(*this, look, list_rc,
                                    with_border, 25);

        type_list->SetItemRenderer(this);
        type_list->SetCursorHandler(this);
        type_list->SetLength(NUM_OZ_TYPES);

        PixelRect button_rc = rc;
        button_rc.right = (rc.left + rc.right) / 2;
        button_rc.top = button_rc.bottom - 30;
        close_button.Create(*this, _T("Close"), ID_CLOSE, button_rc);

        oz.set_shape(ObservationZone::Shape::LINE);

        type_list->SetFocus();
    }
Пример #14
0
void
KeyboardControl::move_buttons_to_row(const TCHAR* buttons, int row,
                                     PixelScalar offset)
{
  if (StringIsEmpty(buttons))
    return;

  ButtonWindow *kb;
  for (unsigned i = 0; buttons[i] != _T('\0'); i++) {
    kb = get_button(buttons[i]);
    if (!kb)
      continue;

    kb->Move(i * button_width + offset, row * button_height);
  }
}
Пример #15
0
void
KeyboardControl::add_button(const TCHAR* caption)
{
  assert(num_buttons < MAX_BUTTONS);

  button_values[num_buttons] = caption[0];

  PixelRect rc;
  rc.left = 0;
  rc.top = 0;
  rc.right = button_width;
  rc.bottom = button_height;

  ButtonWindow *button = &buttons[num_buttons++];
  button->set(*this, caption, (unsigned)caption[0], rc);
  button->SetFont(*look.button.font);
}
  void Create(PixelSize size) {
    TopWindowStyle style;
    style.Resizable();

    SingleWindow::Create(_T("RunFAITriangleSectorRenderer"),
                         size, style);

    const PixelRect rc = GetClientRect();

    WindowStyle with_border;
    with_border.Border();

    PixelRect button_rc = rc;
    button_rc.top = button_rc.bottom - 30;
    close_button.Create(*this, _T("Close"), ID_CLOSE, button_rc);
    close_button.SetFont(normal_font);

    triangle_window.Create(*this, rc, with_border);
  }
Пример #17
0
  void Create(PixelSize size) {
    SingleWindow::Create(_T("Test"), size);

    WindowStyle style;
    style.Disable();

    const PixelRect rc = GetClientRect();
    close_button.Create(*this, _T("Close"), CLOSE, GetButtonRect(rc));
    test_window.Create(*this, rc, style);
  }
Пример #18
0
  void set(PixelRect _rc) {
    SingleWindow::set(_T("RunCanvas"), _T("RunCanvas"), _rc);

    PixelRect rc = get_client_rect();

    PixelRect button_rc = rc;
    button_rc.bottom -= 5;
    button_rc.top = button_rc.bottom - 25;

#ifndef ENABLE_OPENGL
    button_rc.left += 5;
    button_rc.right = button_rc.left + 65;

    buffer_button.set(*this, _T("Buffer"), ID_BUFFER, button_rc);
#endif

    button_rc.right = rc.right - 5;
    button_rc.left = button_rc.right - 65;

    close_button.set(*this, _T("Close"), ID_CLOSE, button_rc);
  }
Пример #19
0
  void set(PixelScalar left, PixelScalar top,
           UPixelScalar width, UPixelScalar height) {
    SingleWindow::set(_T("RunMapWindow"), _T("RunMapWindow"),
                      left, top, width, height);

    PixelRect rc = get_client_rect();
    map.set(*this, rc);
    map.SetWaypoints(&way_points);
    map.SetAirspaces(&airspace_database);
    map.SetTopography(topography);
    map.SetTerrain(terrain);
    if (terrain != NULL)
      map.SetLocation(terrain->GetTerrainCenter());

    rc.left = 5;
    rc.top = 5;
    rc.right = rc.left + 60;
    rc.bottom = rc.top + 20;
    close_button.set(*this, _T("Close"), ID_CLOSE, rc);
    close_button.set_font(Fonts::map);
    close_button.bring_to_top();
  }
Пример #20
0
  void Create(PixelSize size) {
    SingleWindow::Create(_T("RunCanvas"), size);

    PixelRect rc = GetClientRect();

    PixelRect button_rc = rc;
    button_rc.bottom -= 5;
    button_rc.top = button_rc.bottom - 25;

#ifndef ENABLE_OPENGL
    button_rc.left += 5;
    button_rc.right = button_rc.left + 65;

    buffer_button.Create(*this, _T("Buffer"), ID_BUFFER, button_rc);
    buffer_button.SetFont(normal_font);
#endif

    button_rc.right = rc.right - 5;
    button_rc.left = button_rc.right - 65;

    close_button.Create(*this, _T("Close"), ID_CLOSE, button_rc);
    close_button.SetFont(normal_font);
  }
Пример #21
0
  void Create(PixelSize size) {
    TopWindowStyle style;
    style.Resizable();

    SingleWindow::Create(_T("RunMapWindow"), size, style);

    PixelRect rc = GetClientRect();
    map.Create(*this, rc);
    map.SetWaypoints(&way_points);
    map.SetAirspaces(&airspace_database);
    map.SetTopography(topography);
    map.SetTerrain(terrain);
    if (terrain != NULL)
      map.SetLocation(terrain->GetTerrainCenter());

    rc.left = 5;
    rc.top = 5;
    rc.right = rc.left + 60;
    rc.bottom = rc.top + 20;
    close_button.Create(*this, _T("Close"), ID_CLOSE, rc);
    close_button.SetFont(Fonts::map);
    close_button.BringToTop();
  }
Пример #22
0
  void Set(PixelRect _rc) {
    SingleWindow::set(_T("RunFinalGlideBarRenderer"), _T("RunFinalGlideBarRenderer"),
                      _rc);

    const PixelRect rc = GetClientRect();

    WindowStyle with_border;
    with_border.Border();

    final_glide.set(*this, rc.left, rc.top, rc.right, rc.bottom, with_border);

    PixelRect button_rc = rc;
    button_rc.top = button_rc.bottom - 30;
    close_button.set(*this, _T("Close"), ID_CLOSE, button_rc);
  }
Пример #23
0
  void Create(PixelSize size) {
    SingleWindow::Create(_T("RunFinalGlideBarRenderer"),
                         size);

    const PixelRect rc = GetClientRect();

    WindowStyle with_border;
    with_border.Border();

    final_glide.Create(*this, rc, with_border);

    PixelRect button_rc = rc;
    button_rc.top = button_rc.bottom - 30;
    close_button.Create(*this, _T("Close"), ID_CLOSE, button_rc);
  }
Пример #24
0
  void set(int left, int top, unsigned width, unsigned height) {
    SingleWindow::set(_T("KeyCodeDumper"), _T("KeyCodeDumper"),
                      left, top, width, height);

    RECT rc = get_client_rect();

    key_code_dumper.set(*this, rc.left, rc.top,
                        rc.right - rc.left, (rc.bottom - rc.top + 1) / 2);
    close_button.set(*this, _T("Close"), ID_CLOSE,
                     rc.left, (rc.top + rc.bottom + 1) / 2,
                     rc.right - rc.left,
                     (rc.top + rc.bottom) / 2);

    key_code_dumper.set_focus();
  }
Пример #25
0
  void set(PixelRect _rc) {
    SingleWindow::set(_T("KeyCodeDumper"), _T("KeyCodeDumper"), _rc);

    PixelRect rc = get_client_rect();

    PixelRect d_rc = rc;
    d_rc.bottom = (rc.top + rc.bottom + 1) / 2;
    key_code_dumper.set(*this, d_rc);

    PixelRect button_rc = rc;
    button_rc.top = (rc.top + rc.bottom + 1) / 2;

    close_button.set(*this, _T("Close"), ID_CLOSE, button_rc);

    key_code_dumper.set_focus();
  }
Пример #26
0
  void Create(PixelSize size) {
    TopWindowStyle style;
    style.Resizable();

    SingleWindow::Create(_T("RunHorizonRenderer"), size, style);

    const PixelRect rc = GetClientRect();

    WindowStyle with_border;
    with_border.Border();

    horizon.Create(*this, rc, with_border);

    PixelRect button_rc = rc;
    button_rc.top = button_rc.bottom - 30;
    close_button.Create(*this, _T("Close"), ID_CLOSE, button_rc);
  }
Пример #27
0
  void Set(PixelRect _rc) {
    TopWindowStyle style;
    style.Resizable();

    SingleWindow::set(_T("RunWindArrowRenderer"), _T("RunWindArrowRenderer"),
                      _rc, style);

    const PixelRect rc = GetClientRect();

    WindowStyle with_border;
    with_border.Border();

    wind.set(*this, rc.left, rc.top, rc.right, rc.bottom, with_border);

    PixelRect button_rc = rc;
    button_rc.top = button_rc.bottom - 30;
    close_button.set(*this, _T("Close"), ID_CLOSE, button_rc);
  }
Пример #28
0
 virtual void OnResize(UPixelScalar width, UPixelScalar height) {
   SingleWindow::OnResize(width, height);
   key_code_dumper.move(0, 0, width, (height + 1) / 2);
   close_button.move(0, (height + 1) / 2, width, height / 2);
 }
Пример #29
0
 virtual bool on_resize(unsigned width, unsigned height) {
   SingleWindow::on_resize(width, height);
   key_code_dumper.move(0, 0, width, (height + 1) / 2);
   close_button.move(0, (height + 1) / 2, width, height / 2);
   return true;
 }