本文整理汇总了C++中WndButton::set_enabled方法的典型用法代码示例。如果您正苦于以下问题:C++ WndButton::set_enabled方法的具体用法?C++ WndButton::set_enabled怎么用?C++ WndButton::set_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WndButton
的用法示例。
在下文中一共展示了WndButton::set_enabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VisitDataFiles
static void
UpdateList()
{
list.clear();
PlaneFileVisitor pfv;
VisitDataFiles(_T("*.xcp"), pfv);
unsigned len = list.size();
if (len > 0)
std::sort(list.begin(), list.end());
plane_list->SetLength(len);
plane_list->invalidate();
WndButton* b = (WndButton*)dialog->FindByName(_T("LoadButton"));
assert(b != NULL);
b->set_enabled(len > 0);
b = (WndButton*)dialog->FindByName(_T("EditButton"));
assert(b != NULL);
b->set_enabled(len > 0);
b = (WndButton*)dialog->FindByName(_T("DeleteButton"));
assert(b != NULL);
b->set_enabled(len > 0);
}
示例2: tpv
static void
RefreshView()
{
wTaskView->invalidate();
OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
if (!tp)
return;
Refreshing = true; // tell onChange routines not to save form!
TPLabelObservationZone ozv;
ObservationZoneConstVisitor &visitor = ozv;
visitor.Visit(*tp->get_oz());
WndFrame* wfrm = NULL;
wfrm = ((WndFrame*)wf->FindByName(_T("lblType")));
if (wfrm)
wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().getType(*tp)));
WndButton* wb;
wb = ((WndButton*)wf->FindByName(_T("butPrevious")));
if (wb)
wb->set_enabled(active_index > 0);
wb = ((WndButton*)wf->FindByName(_T("butNext")));
if (wb)
wb->set_enabled(active_index < (ordered_task->task_size() - 1));
wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts"));
assert(wb);
wb->set_visible(active_index == 0);
if (ordered_task->optional_start_points_size() == 0)
wb->SetCaption(_("Enable Alternate Starts"));
else {
TCHAR tmp[50];
_stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"),
ordered_task->optional_start_points_size());
wb->SetCaption(tmp);
}
EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL);
TCHAR bufType[100];
TCHAR bufNamePrefix[100];
TPLabelTaskPoint tpv(bufType, bufNamePrefix);
TaskPointConstVisitor &tp_visitor = tpv;
tp_visitor.Visit(*tp);
wf->SetCaption(tpv.textType);
wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation")));
if (wfrm) {
TCHAR buff[100];
_stprintf(buff, _T("%s %s"), tpv.textNamePrefix,
tp->get_waypoint().Name.c_str());
wfrm->SetCaption(buff);
}
Refreshing = false; // reactivate onChange routines
}
示例3: 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;
}