本文整理汇总了C++中ToolBar::is_enabled方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolBar::is_enabled方法的具体用法?C++ ToolBar::is_enabled怎么用?C++ ToolBar::is_enabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolBar
的用法示例。
在下文中一共展示了ToolBar::is_enabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_process_message
void ToolBar_Impl::on_process_message(std::shared_ptr<GUIMessage> &msg)
{
if (!toolbar->is_enabled())
return;
std::shared_ptr<GUIMessage_Input> input_msg = std::dynamic_pointer_cast<GUIMessage_Input>(msg);
if (input_msg)
{
const InputEvent &e = input_msg->input_event;
if (e.type == InputEvent::released && e.id == mouse_right)
{
int index = find_item_at(e.mouse_pos);
if (!func_mouse_right_up.is_null())
func_mouse_right_up.invoke(e.mouse_pos, index);
}
else if (mouse_mode == mouse_mode_normal)
{
int index = find_item_at(e.mouse_pos);
if (index == -1)
{
if (index_hot_item != -1)
{
index_hot_item = -1;
toolbar->request_repaint();
}
return;
}
if (e.type == InputEvent::pressed && e.id == mouse_left)
{
index_hot_item = -1;
index_pressed_item = index;
mouse_mode = mouse_mode_pressed;
toolbar->request_repaint();
toolbar->capture_mouse(true);
}
else
{
index_hot_item = index;
toolbar->request_repaint();
}
}
else if (mouse_mode == mouse_mode_pressed)
{
if (e.type == InputEvent::released && e.id == mouse_left)
{
toolbar->capture_mouse(false);
mouse_mode = mouse_mode_normal;
int index = find_item_at(e.mouse_pos);
bool perform_click = (index == index_pressed_item);
bool pressed_state = items[index_pressed_item].is_pressed();
if (pressed_state == true && single_select_mode)
{
return;
}
if (items[index_pressed_item].impl->toggling && perform_click)
items[index_pressed_item].impl->pressed = !items[index_pressed_item].impl->pressed;
index_pressed_item = -1;
index_hot_item = index;
toolbar->request_repaint();
if (perform_click)
{
if (!func_item_clicked.is_null())
func_item_clicked.invoke(items[index]);
if (items[index].is_toggling() && single_select_mode)
{
unselect_all(items[index].impl.get());
if (!func_item_selected.is_null())
func_item_selected.invoke(items[index]);
}
}
}
}
}
std::shared_ptr<GUIMessage_Pointer> pointer = std::dynamic_pointer_cast<GUIMessage_Pointer>(msg);
if (pointer)
{
if (pointer->pointer_type == GUIMessage_Pointer::pointer_leave)
{
if (index_hot_item != -1)
{
index_hot_item = -1;
toolbar->request_repaint();
}
}
}
}