void RichEdit::MouseWheel(Point p, int zdelta, dword keyflags) { if(keyflags == K_CTRL && !IsNull(floating_zoom)) { floating_zoom = minmax(floating_zoom + zdelta / 480.0, 0.5, 10.0); RefreshLayoutDeep(); } else sb.Wheel(zdelta); }
// Fix to avoid black corners temorarily artifact void Ctrl::Create0(Ctrl::CreateBox *cr) { GuiLock __; ASSERT(IsMainThread()); LLOG("Ctrl::Create(parent = " << (void *)parent << ") in " <<UPP::Name(this) << BeginIndent); ASSERT(!IsChild() && !IsOpen()); Rect r = GetRect(); AdjustWindowRectEx(r, cr->style, FALSE, cr->exstyle); isopen = true; top = new Top; ASSERT(!cr->parent || IsWindow(cr->parent)); cr->style &= ~WS_VISIBLE; if(!IsWinXP()) cr->dropshadow = false; #ifdef PLATFORM_WINCE if(parent) top->hwnd = CreateWindowExW(cr->exstyle, cr->savebits ? cr->dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" : cr->dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", L"", cr->style, 0, 0, 0, 0, cr->parent, NULL, hInstance, this); else top->hwnd = CreateWindowW(L"UPP-CLASS-W", L"", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, cr->parent, NULL, hInstance, this); #else if(IsWinNT() && (!cr->parent || IsWindowUnicode(cr->parent))) top->hwnd = CreateWindowExW(cr->exstyle, cr->savebits ? cr->dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" : cr->dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", L"", cr->style, 0, 0, 0, 0, cr->parent, NULL, hInstance, this); else top->hwnd = CreateWindowEx(cr->exstyle, cr->savebits ? cr->dropshadow ? "UPP-CLASS-SB-DS-A" : "UPP-CLASS-SB-A" : cr->dropshadow ? "UPP-CLASS-DS-A" : "UPP-CLASS-A", "", cr->style, 0, 0, 0, 0, cr->parent, NULL, hInstance, this); #endif inloop = false; ASSERT(top->hwnd); ::MoveWindow(top->hwnd, r.left, r.top, r.Width(), r.Height(), false); // To avoid "black corners" artifact effect ::ShowWindow(top->hwnd, visible ? cr->show : SW_HIDE); // ::UpdateWindow(hwnd); StateH(OPEN); LLOG(EndIndent << "//Ctrl::Create in " <<UPP::Name(this)); RegisterDragDrop(top->hwnd, (LPDROPTARGET) (top->dndtgt = NewUDropTarget(this))); CancelMode(); RefreshLayoutDeep(); }
void Ctrl::Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow) { GuiLock __; ASSERT_(IsMainThread(), "Window creation can only happen in the main thread"); LLOG("Ctrl::Create(parent = " << (void *)parent << ") in " <<UPP::Name(this) << LOG_BEGIN); ASSERT(!IsChild() && !IsOpen()); Rect r = GetRect(); AdjustWindowRectEx(r, style, FALSE, exstyle); isopen = true; top = new Top; ASSERT(!parent || IsWindow(parent)); style &= ~WS_VISIBLE; if(!IsWinXP()) dropshadow = false; #ifdef PLATFORM_WINCE if(parent) top->hwnd = CreateWindowExW(exstyle, savebits ? dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" : dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", L"", style, 0, 0, 0, 0, parent, NULL, hInstance, this); else top->hwnd = CreateWindowW(L"UPP-CLASS-W", L"", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, hInstance, this); #else if(IsWinNT() && (!parent || IsWindowUnicode(parent))) top->hwnd = CreateWindowExW(exstyle, savebits ? dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" : dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", L"", style, 0, 0, 0, 0, parent, NULL, hInstance, this); else top->hwnd = CreateWindowEx(exstyle, savebits ? dropshadow ? "UPP-CLASS-SB-DS-A" : "UPP-CLASS-SB-A" : dropshadow ? "UPP-CLASS-DS-A" : "UPP-CLASS-A", "", style, 0, 0, 0, 0, parent, NULL, hInstance, this); #endif inloop = false; ASSERT(top->hwnd); ::MoveWindow(top->hwnd, r.left, r.top, r.Width(), r.Height(), false); // To avoid "black corners" artifact effect ::ShowWindow(top->hwnd, visible ? show : SW_HIDE); // ::UpdateWindow(hwnd); StateH(OPEN); LLOG(LOG_END << "//Ctrl::Create in " <<UPP::Name(this)); RegisterDragDrop(top->hwnd, (LPDROPTARGET) (top->dndtgt = NewUDropTarget(this))); CancelMode(); RefreshLayoutDeep(); }
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost) { ASSERT(!IsChild() && !IsOpen() && FindTopCtrl() < 0); NewTop(); if(owner) { Ctrl *owner_window = owner->GetTopWindow(); if(!owner_window) owner_window = owner->GetTopCtrl(); ASSERT(owner_window->IsOpen()); if(owner_window != desktop) { owner_window->SetForeground(); top->owner_window = owner_window; } } topctrl.Add(this); popup = isopen = true; RefreshLayoutDeep(); if(activate) SetFocusWnd(); AddInvalid(GetRect()); }