void WndProperty::BeginEditing() { if (edit.is_read_only()) { /* this would display xml file help on a read-only wndproperty if it exists */ OnHelp(); } else if (mDataField != NULL && mDataField->SupportCombo) { SingleWindow *root = (SingleWindow *)get_root_owner(); /* if this asserton fails, then there no valid root window could be found - maybe it didn't register its wndproc? */ assert(root != NULL); dlgComboPicker(*root, this); } else if (CanEditInPlace()) { edit.set_focus(); } else if (mDataField != NULL) { const TCHAR *value = mDataField->GetAsString(); if (value == NULL) return; StaticString<EDITSTRINGSIZE> buffer(value); if (!TextEntryDialog(*(SingleWindow *)get_root_owner(), buffer, GetCaption())) return; mDataField->SetAsString(buffer); RefreshDisplay(); } }
bool WndProperty::on_mouse_down(int x, int y) { POINT Pos; if (mDialogStyle) { if (!edit.is_read_only()) { // when they click on the label SingleWindow *root = (SingleWindow *)get_root_owner(); /* if this asserton fails, then there no valid root window could be found - maybe it didn't register its wndproc? */ assert(root != NULL); dlgComboPicker(*root, this); } else { OnHelp(); // this would display xml file help on a read-only wndproperty if it exists } } else { if (!edit.has_focus()) { if (!edit.is_read_only()) edit.set_focus(); return true; } Pos.x = x; Pos.y = y; //POINTSTOPOINT(Pos, MAKEPOINTS(lParam)); mDownDown = (PtInRect(&mHitRectDown, Pos) != 0); if (mDownDown) { DecValue(); invalidate(mHitRectDown); } mUpDown = (PtInRect(&mHitRectUp, Pos) != 0); if (mUpDown) { IncValue(); invalidate(mHitRectUp); } set_capture(); } return true; }
void WndProperty::BeginEditing() { if (edit.is_read_only()) { /* this would display xml file help on a read-only wndproperty if it exists */ OnHelp(); } else if (mDialogStyle) { SingleWindow *root = (SingleWindow *)get_root_owner(); /* if this asserton fails, then there no valid root window could be found - maybe it didn't register its wndproc? */ assert(root != NULL); dlgComboPicker(*root, this); } else { edit.set_focus(); } }
TS_DefaultSieveProcedure(HWND hwnd, TSTaskList* tasklist) { HWND root_owner; DWORD style; DWORD exstyle; int i; ULONG_PTR extra[1]; hwnd = GetLastActivePopup(hwnd); style = GetWindowLongPtr(hwnd, GWL_STYLE); if (!(style & WS_VISIBLE) || (style & WS_DISABLED)) return TRUE; exstyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); if (!( (!(exstyle & WS_EX_TOOLWINDOW)) || (exstyle & WS_EX_APPWINDOW) )) { return TRUE; } root_owner = get_root_owner(hwnd); for (i = 0; i < tasklist->count; i++) { if (root_owner == (HWND)(tasklist->list[i]->extra[0])) { tasklist->list[i]->window = hwnd; GetWindowText( hwnd, tasklist->list[i]->title, NUMBER_OF(tasklist->list[i]->title) ); tasklist->list[i]->extra[0] = (ULONG_PTR)root_owner; return TRUE; } } extra[0] = (ULONG_PTR)root_owner; return TSTaskList_Append(tasklist, hwnd, extra, 1); }
int WndForm::ShowModal() { assert_none_locked(); #define OPENCLOSESUPPRESSTIME 500 #ifndef USE_GDI ContainerWindow *root = get_root_owner(); WindowReference old_focus_reference = root->GetFocusedWindowReference(); #else HWND oldFocusHwnd; #endif /* USE_GDI */ PeriodClock enter_clock; if (is_embedded() && !is_altair()) enter_clock.update(); show_on_top(); mModalResult = 0; #ifdef USE_GDI oldFocusHwnd = ::GetFocus(); if (oldFocusHwnd != NULL) ::SendMessage(oldFocusHwnd, WM_CANCELMODE, 0, 0); #endif /* USE_GDI */ set_focus(); focus_first_control(); bool hastimed = false; WndForm::timeAnyOpenClose.update(); // when current dlg opens or child closes main_window.add_dialog(this); #ifndef USE_GDI main_window.refresh(); #endif #ifdef ANDROID EventLoop loop(*event_queue, main_window); Event event; #elif defined(ENABLE_SDL) EventLoop loop(main_window); SDL_Event event; #else DialogEventLoop loop(*this); MSG event; #endif while ((mModalResult == 0 || force) && loop.get(event)) { #if defined(ENABLE_SDL) && !defined(ANDROID) if (event.type == SDL_QUIT) { mModalResult = mrCancel; continue; } #endif if (!main_window.FilterEvent(event, this)) continue; // hack to stop exiting immediately if (is_embedded() && !is_altair() && !hastimed && is_user_input(event)) { if (!enter_clock.check(200)) /* ignore user input in the first 200ms */ continue; else hastimed = true; } if (is_embedded() && is_mouse_up(event) && !timeAnyOpenClose.check(OPENCLOSESUPPRESSTIME)) /* prevents child click from being repeat-handled by parent if buttons overlap */ continue; if (mOnKeyDownNotify != NULL && is_key_down(event) && #ifdef USE_GDI identify_descendant(event.hwnd) && #endif !check_special_key(this, event) && mOnKeyDownNotify(*this, get_key_code(event))) continue; #if defined(ENABLE_SDL) && !defined(ANDROID) if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_TAB) { /* the Tab key moves the keyboard focus */ const Uint8 *keystate = ::SDL_GetKeyState(NULL); event.key.keysym.sym = keystate[SDLK_LSHIFT] || keystate[SDLK_RSHIFT] ? SDLK_UP : SDLK_DOWN; } #endif if (is_key_down(event) && #ifdef USE_GDI identify_descendant(event.hwnd) && #endif (get_key_code(event) == VK_UP || get_key_code(event) == VK_DOWN)) { /* VK_UP and VK_DOWN move the focus only within the current control group - but we want it to behave like Shift-Tab and Tab */ if (!check_key(this, event)) { /* this window doesn't handle VK_UP/VK_DOWN */ if (get_key_code(event) == VK_DOWN) focus_next_control(); else focus_previous_control(); continue; } } #ifndef USE_GDI if (is_key_down(event) && get_key_code(event) == VK_ESCAPE) { mModalResult = mrCancel; continue; } #endif /* map VK_ESCAPE to mrOK on Altair, because the Escape key is expected to be the one that saves and closes a dialog */ if (is_altair() && is_key_down(event) && get_key_code(event) == VK_ESCAPE) { mModalResult = mrOK; continue; } loop.dispatch(event); } // End Modal Loop main_window.remove_dialog(this); // static. this is current open/close or child open/close WndForm::timeAnyOpenClose.update(); #ifdef USE_GDI SetFocus(oldFocusHwnd); #else if (old_focus_reference.Defined()) { Window *old_focus = old_focus_reference.Get(*root); if (old_focus != NULL) old_focus->set_focus(); } #endif /* !USE_GDI */ return mModalResult; }