当前位置: 首页>>代码示例>>C++>>正文


C++ ListView::onActivate方法代码示例

本文整理汇总了C++中ListView::onActivate方法的典型用法代码示例。如果您正苦于以下问题:C++ ListView::onActivate方法的具体用法?C++ ListView::onActivate怎么用?C++ ListView::onActivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListView的用法示例。


在下文中一共展示了ListView::onActivate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Application_processMessageQueue

static void Application_processMessageQueue() {
  while(!messageQueue.empty()) {
    Message message = messageQueue.takeFirst();
    if(message.type == Message::Type::ListView_OnActivate) {
      ListView* listView = (ListView*)message.object;
      if(listView->onActivate) listView->onActivate();
    }
  }
}
开发者ID:TazeTSchnitzel,项目名称:panui,代码行数:9,代码来源:application.cpp

示例2: windowProc

static LRESULT CALLBACK Shared_windowProc(WindowProc windowProc, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
  Object* object = (Object*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  if(object == nullptr) return DefWindowProc(hwnd, msg, wparam, lparam);
  Window& window = dynamic_cast<Window*>(object) ? *(Window*)object : *((Widget*)object)->Sizable::state.window;

  bool process = true;
  if(!pWindow::modal.empty() && !pWindow::modal.find(&window.p)) process = false;
  if(applicationState.quit) process = false;
  if(process == false) return DefWindowProc(hwnd, msg, wparam, lparam);

  switch(msg) {
  case WM_CTLCOLORBTN:
  case WM_CTLCOLORSTATIC: {
    Object* object = (Object*)GetWindowLongPtr((HWND)lparam, GWLP_USERDATA);
    if(object == nullptr) break;
    if(dynamic_cast<HexEdit*>(object) || dynamic_cast<LineEdit*>(object) || dynamic_cast<TextEdit*>(object)) {
      //text edit controls, when disabled, use CTLCOLORSTATIC instead of CTLCOLOREDIT
      //override this behavior: we do not want read-only edit controls to use the parent window background color
      return windowProc(hwnd, WM_CTLCOLOREDIT, wparam, lparam);
    } else if(!GetParentWidget((Sizable*)object) && window.p.brush) {
      SetBkColor((HDC)wparam, window.p.brushColor);
      return (INT_PTR)window.p.brush;
    }
    break;
  }

  case WM_DRAWITEM: {
    unsigned id = LOWORD(wparam);
    HWND control = GetDlgItem(hwnd, id);
    Object* object = (Object*)GetWindowLongPtr(control, GWLP_USERDATA);
    if(object == nullptr) break;
    if(dynamic_cast<TabFrame*>(object)) { ((TabFrame*)object)->p.onDrawItem(lparam); return TRUE; }
    break;
  }

  case WM_COMMAND: {
    unsigned id = LOWORD(wparam);
    HWND control = GetDlgItem(hwnd, id);
    Object* object = control ? (Object*)GetWindowLongPtr(control, GWLP_USERDATA) : pObject::find(id);
    if(object == nullptr) break;
    if(dynamic_cast<Item*>(object)) { ((Item*)object)->p.onActivate(); return FALSE; }
    if(dynamic_cast<CheckItem*>(object)) { ((CheckItem*)object)->p.onToggle(); return FALSE; }
    if(dynamic_cast<RadioItem*>(object)) { ((RadioItem*)object)->p.onActivate(); return FALSE; }
    if(dynamic_cast<Button*>(object)) { ((Button*)object)->p.onActivate(); return FALSE; }
    if(dynamic_cast<CheckButton*>(object)) { ((CheckButton*)object)->p.onToggle(); return FALSE; }
    if(dynamic_cast<CheckLabel*>(object)) { ((CheckLabel*)object)->p.onToggle(); return FALSE; }
    if(dynamic_cast<ComboButton*>(object) && HIWORD(wparam) == CBN_SELCHANGE) { ((ComboButton*)object)->p.onChange(); return FALSE; }
    if(dynamic_cast<LineEdit*>(object) && HIWORD(wparam) == EN_CHANGE) { ((LineEdit*)object)->p.onChange(); return FALSE; }
    if(dynamic_cast<RadioButton*>(object)) { ((RadioButton*)object)->p.onActivate(); return FALSE; }
    if(dynamic_cast<RadioLabel*>(object)) { ((RadioLabel*)object)->p.onActivate(); return FALSE; }
    if(dynamic_cast<TextEdit*>(object) && HIWORD(wparam) == EN_CHANGE) { ((TextEdit*)object)->p.onChange(); return FALSE; }
    break;
  }

  case WM_NOTIFY: {
    unsigned id = LOWORD(wparam);
    HWND control = GetDlgItem(hwnd, id);
    Object* object = (Object*)GetWindowLongPtr(control, GWLP_USERDATA);
    if(object == nullptr) break;
    if(dynamic_cast<ListView*>(object) && ((LPNMHDR)lparam)->code == LVN_ITEMACTIVATE) { ((ListView*)object)->p.onActivate(lparam); break; }
    if(dynamic_cast<ListView*>(object) && ((LPNMHDR)lparam)->code == LVN_ITEMCHANGED) { ((ListView*)object)->p.onChange(lparam); break; }
    if(dynamic_cast<ListView*>(object) && ((LPNMHDR)lparam)->code == NM_CUSTOMDRAW) { return ((ListView*)object)->p.onCustomDraw(lparam); }
    if(dynamic_cast<TabFrame*>(object) && ((LPNMHDR)lparam)->code == TCN_SELCHANGE) { ((TabFrame*)object)->p.onChange(); break; }
    break;
  }

  case WM_APP + AppMessage::ListView_onActivate: {
    ListView* listView = (ListView*)lparam;
    if(listView && listView->onActivate) listView->onActivate();
    break;
  }

  case WM_HSCROLL:
  case WM_VSCROLL: {
    Object* object = nullptr;
    if(lparam) {
      object = (Object*)GetWindowLongPtr((HWND)lparam, GWLP_USERDATA);
    } else {
      unsigned id = LOWORD(wparam);
      HWND control = GetDlgItem(hwnd, id);
      object = (Object*)GetWindowLongPtr(control, GWLP_USERDATA);
    }
    if(object == nullptr) break;
    if(dynamic_cast<HorizontalScroller*>(object)) { ((HorizontalScroller*)object)->p.onChange(wparam); return TRUE; }
    if(dynamic_cast<VerticalScroller*>(object)) { ((VerticalScroller*)object)->p.onChange(wparam); return TRUE; }
    if(dynamic_cast<HorizontalSlider*>(object)) { ((HorizontalSlider*)object)->p.onChange(); return TRUE; }
    if(dynamic_cast<VerticalSlider*>(object)) { ((VerticalSlider*)object)->p.onChange(); return TRUE; }
    break;
  }
  }

  return windowProc(hwnd, msg, wparam, lparam);
}
开发者ID:Brunnis,项目名称:bsnes-mercury,代码行数:93,代码来源:utility.cpp


注:本文中的ListView::onActivate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。