예제 #1
0
static INT_PTR CALLBACK
win32ui_pokefinder_proc( HWND hWnd GCC_UNUSED, UINT msg,
                WPARAM wParam, LPARAM lParam )
{
  int height;

  switch( msg ) {

    case WM_COMMAND:
      switch( LOWORD( wParam ) ) {
        case IDCLOSE:
        case IDCANCEL:
          win32ui_pokefinder_close();
          return TRUE;
        case IDC_PF_INC:
          win32ui_pokefinder_incremented();
          return TRUE;
        case IDC_PF_DEC:
          win32ui_pokefinder_decremented();
          return TRUE;
        case IDC_PF_SEARCH:
          win32ui_pokefinder_search();
          return TRUE;
        case IDC_PF_RESET:
          win32ui_pokefinder_reset();
          return TRUE;
      }
      break;

    case WM_SIZE:
      height = HIWORD( lParam );
      move_button( IDC_PF_INC, height );
      move_button( IDC_PF_DEC, height );
      move_button( IDC_PF_SEARCH, height );
      move_button( IDC_PF_RESET, height );
      move_button( IDCLOSE, height );
      return TRUE;
	
    case WM_CLOSE:
      win32ui_pokefinder_close();
      return TRUE;

    case WM_NOTIFY:
      switch ( ( ( LPNMHDR ) lParam )->code ) {
        case NM_DBLCLK:
          possible_click( ( LPNMITEMACTIVATE ) lParam );
          return TRUE; /* The return value for this notification is not used */
      }
      break;      
  }
  return FALSE;
}
예제 #2
0
파일: catalog.cpp 프로젝트: qks1/erk
Catalog::Catalog(QWidget *parent) :
    QWidget(parent){

    groups = new QTreeWidget();
    header = groups->header();

    // кнопка сброса фильтра по группам должна лежать на заголовке каталога,
    // поэтому передаём указатель на него в качестве виджета-предка
    reset_groups = new QPushButton("X", header);

    // устанавливаем, чтобы у каталога никогда не отображалась полоса прокрутки
    groups->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    // задаём устанавливаем заголовок каталога по умолчанию
    default_header = "Выберите группу";
    groups->setHeaderLabel(default_header);

    // заполняем каталог
    // если не удалось (т.е. какие-то проблемы с БД), устанавливаем ok=false,
    // чтобы другие виджеты могли увидеть, что с БД проблемы
    ok = (addGroups() ? true : false);

    // помещаем на место кнопку сброса фильтра
    move_button();

    // помещаем дерево в layout (для корректного отображения)
    QHBoxLayout* lt = new QHBoxLayout;
    lt->addWidget(groups);
    setLayout(lt);
    lt->setMargin(0);

    // соединяем сигналы со слотами
    connects();

}
예제 #3
0
void
KeyboardControl::move_buttons()
{
  move_buttons_to_row(_T("1234567890"), 0);
  move_buttons_to_row(_T("QWERTYUIOP"), 1);
  move_buttons_to_row(_T("ASDFGHJKL"), 2, button_width / 3);
  move_buttons_to_row(_T("ZXCVBNM,."), 3, button_width * 2 / 3);

  if (is_landscape()) {
    move_button(_T('-'), button_width * 9, Layout::Scale(160));

    move_button(_T(' '), Layout::Scale(80), Layout::Scale(160));
    resize_button(_T(' '), Layout::Scale(93), Layout::Scale(40));
  } else {
    move_button(_T('-'), button_width * 8, button_height * 4);

    move_button(_T(' '), button_width * 2, button_height * 4);
    resize_button(_T(' '), button_width * 11 / 2, button_height);
  }
}
/* ----------------------------------------------------------------------------
 * When the mouse is moved, if the mouse button is held
 * down, the scrollbar button is moved with the mouse.
 */
void scrollbar::widget_on_mouse_move(int x, int y) {
    if(!mouse_clicking) return;
    
    move_button(x, y);
}
/* ----------------------------------------------------------------------------
 * When the mouse is held down, the scrollbar button
 * is moved to that location.
 */
void scrollbar::widget_on_mouse_down(int button, int x, int y) {
    if(button != 1) return;
    
    move_button(x, y);
}