void KeyboardWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { shift_button = nullptr; OnResize(rc); TCHAR caption[] = _T(" "); for (const TCHAR *i = keyboard_letters; !StringIsEmpty(i); ++i) { caption[0] = *i; AddButton(parent, caption, *i); } AddButton(parent, _T("Space"), ' '); AddButton(parent, _T("."), '.'); AddButton(parent, _T(","), ','); AddButton(parent, _T("-"), '-'); if (show_shift_button) { ButtonWindowStyle style; style.Hide(); shift_button = new WndSymbolButton(parent, look, _T("v"), { 0, 0, 16, 16 }, style, *this, SHIFT); } shift_state = true; }
virtual void Prepare(ContainerWindow &parent, const PixelRect &rc) override { assert(!visible); ButtonWindowStyle style; style.Hide(); style.TabStop(); const DialogLook &look = UIGlobals::GetDialogLook(); const Layout layout = CalculateLayout(rc); edit_button = new WndButton(parent, look, _("Edit Point"), layout.edit, style, *listener, EDIT); mutate_button = new WndButton(parent, look, _("Make Finish"), layout.down, style, *listener, MUTATE); down_button = new WndSymbolButton(parent, look, _T("v"), layout.down, style, *listener, DOWN); up_button = new WndSymbolButton(parent, look, _T("^"), layout.down, style, *listener, UP); clear_all_button = new WndButton(parent, look, _("Clear All"), layout.clear_all, style, *listener, CLEAR_ALL); }
void MacCreadySetupPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { ButtonWindowStyle style; style.Hide(); style.TabStop(); SetWindow(new WndButton(parent, UIGlobals::GetDialogLook(), GetCaption(), rc, style, *this, 1)); }
/* virtual methods from Widget */ virtual void Prepare(ContainerWindow &parent, const PixelRect &rc) override { Layout layout(rc); ButtonWindowStyle style; style.Hide(); style.TabStop(); demo_button.Create(parent, _("Demo"), layout.demo, style, *this, DEMO); save_button.Create(parent, _("Save"), layout.save, style, *this, SAVE); }
MenuBar::MenuBar(ContainerWindow &parent) { const PixelRect rc = parent.get_client_rect(); ButtonWindowStyle style; style.Hide(); style.Border(); style.multiline(); for (unsigned i = 0; i < MAX_BUTTONS; ++i) { PixelRect button_rc = GetButtonPosition(i, rc); buttons[i].set(parent, _T(""), button_rc, style); } }
MenuBar::MenuBar(ContainerWindow &parent) { const RECT rc = parent.get_client_rect(); int x, y, xsize, ysize; ButtonWindowStyle style; style.hide(); style.border(); style.multiline(); for (unsigned i = 0; i < MAX_BUTTONS; ++i) { GetButtonPosition(i, rc, &x, &y, &xsize, &ysize); buttons[i].set(parent, _T(""), i, x, y, xsize, ysize, style); } }
void OffsetButtonsWidget::Prepare(ContainerWindow &parent, const PixelRect &total_rc) { PixelRect rc[ARRAY_SIZE(buttons)]; LayoutOffsetButtons(total_rc, rc); ButtonWindowStyle style; style.TabStop(); style.Hide(); for (unsigned i = 0; i < ARRAY_SIZE(buttons); ++i) { TCHAR caption[16]; _stprintf(caption, format, (double)offsets[i]); buttons[i] = new WndButton(parent, look, caption, rc[i], style, *this, i); } }
void KeyboardWidget::AddButton(ContainerWindow &parent, const TCHAR *caption, unsigned ch) { assert(num_buttons < MAX_BUTTONS); ButtonWindowStyle style; style.Hide(); PixelRect rc; rc.left = 0; rc.top = 0; rc.right = button_width; rc.bottom = button_height; CharacterButton &button = buttons[num_buttons++]; button.Create(parent, look, caption, rc, on_character, ch, style); }
void SimulatorPromptWindow::OnCreate() { ContainerWindow::OnCreate(); const PixelRect rc = GetClientRect(); ButtonWindowStyle style; style.TabStop(); fly_button.Create(*this, _T("Fly"), rc, style, action_listener, FLY); sim_button.Create(*this, _T("Simulator"), rc, style, action_listener, SIMULATOR); if (have_quit_button) quit_button.Create(*this, _("Quit"), rc, style, action_listener, QUIT); }
void set(ContainerWindow &parent, const TCHAR *text, unsigned _index, int left, int top, unsigned width, unsigned height, ButtonWindowStyle style=ButtonWindowStyle()) { index = _index; #ifdef GREEN_MENU style.enable_custom_painting(); #endif ButtonWindow::set(parent, text, left, top, width, height, style); }
WndButton::WndButton(ContainerWindow &parent, const DialogLook &_look, const TCHAR *Caption, const PixelRect &rc, ButtonWindowStyle style, ClickNotifyCallback _click_callback) :look(_look), renderer(look.button), listener(NULL), click_callback(_click_callback) { style.EnableCustomPainting(); Create(parent, Caption, rc, style); }
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; }
WndButton::WndButton(ContainerWindow &parent, const DialogLook &_look, const TCHAR *Caption, const PixelRect &rc, ButtonWindowStyle style, ClickNotifyCallback _click_callback, LeftRightNotifyCallback _left_callback, LeftRightNotifyCallback _right_callback) :look(_look), renderer(look.button), listener(NULL), click_callback(_click_callback), left_callback(_left_callback), right_callback(_right_callback) { style.EnableCustomPainting(); set(parent, Caption, rc, style); SetFont(*look.button.font); }
WndButton::WndButton(ContainerWindow &parent, const DialogLook &_look, const TCHAR *caption, const PixelRect &rc, ButtonWindowStyle style, ActionListener &_listener, int _id) :look(_look), renderer(look.button), #ifdef USE_GDI id(_id), #endif listener(&_listener), click_callback(NULL) { style.EnableCustomPainting(); #ifdef USE_GDI /* use BaseButtonWindow::COMMAND_BOUNCE_ID */ Create(parent, caption, rc, style); #else /* our custom SDL/OpenGL button doesn't need this hack */ Create(parent, caption, _id, rc, style); #endif }
void SetDefaultHidden() { style.Hide(); }