void QWidgetWindow::handleScreenChange() { // Send an event recursively to the widget and its children. sendScreenChangeRecursively(m_widget); // Invalidate the backing store buffer and repaint immediately. if (screen()) repaintWindow(); }
void keyDown(char character, int virtualKey) { _pressedChar = character; repaintWindow(); if(virtualKey == VK_END) exitApplication(); }
void mouseMove(int x, int y) { if(_mousePressed) { _mouseX = x; _mouseY = y; repaintWindow(); } }
void NextEvent(MWEvent *event, int socket) { fd_set fdmask; XEvent xev; static int nexttimeoutinitialized=0; static struct timeval nexttimeout; struct timeval timeout,oldtime,newtime; int ret; char c; if (!nexttimeoutinitialized) { nexttimeoutinitialized=1; nexttimeout.tv_sec=app_resources.time_interval/1000; nexttimeout.tv_usec=1000*(app_resources.time_interval%1000); } while (1) { icon_flash = (++icon_flash) % ICON_FLASH_PERIOD; if (!XPending(dpy)) /* this does an XFlush, too */ if (flashIcon && !icon_flash && !mapped) { /* invert the icon */ iconInverted = !iconInverted; repaintIcon(); } /* * Look for events. Try to arrange that X events have priority over * network traffic. See if there's an X event pending. If so, check * for a net event, too; if not, select on both the network and the X * connection. If that doesn't time out, but there's no X event * pending, try again, just selecting on the X connection. If that * times out, let the network event get processed. * * Can't just select on the two fds, because there may be X events * pending in the queue that have already been read. * * This may look baroque, but we've seen some instances where X server * latency seems to let the network events take priority over sever * events, leading to sluggish keyboard response and lots of local * death. * */ if (!XPending(dpy)) { FD_ZERO(&fdmask); FD_SET(displayFD, &fdmask); FD_SET(socket, &fdmask); for (ret=0;ret<=0;) { if ((nexttimeout.tv_sec<0)|| ((nexttimeout.tv_sec==0)&&(nexttimeout.tv_usec<=0))) { nexttimeout.tv_sec=app_resources.time_interval/1000; nexttimeout.tv_usec= 1000*(app_resources.time_interval%1000); if (app_resources.robotic==TRUE) { event->eventType=RandomEvent(); return; } } timeout.tv_sec=nexttimeout.tv_sec; timeout.tv_usec=nexttimeout.tv_usec; gettimeofday(&oldtime,0); ret=select(32,&fdmask,NULL,NULL,&timeout); gettimeofday(&newtime,0); nexttimeout.tv_sec-=newtime.tv_sec-oldtime.tv_sec; nexttimeout.tv_usec-=newtime.tv_usec-oldtime.tv_usec; if (nexttimeout.tv_usec<0) { nexttimeout.tv_sec--; nexttimeout.tv_usec+=1000000; } if (ret==-1) { if (errno!=EINTR) MWError("select error on events"); } else if (ret==0) { nexttimeout.tv_sec=app_resources.time_interval/1000; nexttimeout.tv_usec= 1000*(app_resources.time_interval%1000); if (app_resources.robotic==TRUE) event->eventType=RandomEvent(); else event->eventType=EVENT_TIMEOUT; return; } } } else { FD_ZERO(&fdmask); FD_SET(socket, &fdmask); timeout.tv_sec = 0; timeout.tv_usec = 0; while ((ret = select(32, &fdmask, NULL, NULL, &timeout)) == -1) if (errno != EINTR) MWError("select error on events"); } if (XPending(dpy)) { XNextEvent(dpy, &xev); switch (xev.type) { case KeyPress: event->eventType = 0; XLookupString((XKeyEvent *) &xev, &c, 1, NULL, NULL); switch(c) { case 'a': case '4': /* keypad */ event->eventType = EVENT_A; return; case 's': case '5': event->eventType = EVENT_S; return; case 'd': case '6': event->eventType = EVENT_D; return; case 'f': case ',': event->eventType = EVENT_F; return; case ' ': case '\033': /* ESC lead in of arrow */ event->eventType = EVENT_BAR; return; case 'q': case '\177': /* DEL */ case '\003': /* ^C */ event->eventType = EVENT_INT; return; } break; #define RightButton Button3 #define MiddleButton Button2 #define LeftButton Button1 case ButtonPress: event->eventType = 0; switch(((XButtonPressedEvent *) &xev)->button & 0xff) { case RightButton: event->eventType = EVENT_RIGHT_D; return; case MiddleButton: event->eventType = EVENT_MIDDLE_D; return; case LeftButton: event->eventType = EVENT_LEFT_D; return; } break; case ButtonRelease: event->eventType = 0; switch(((XButtonReleasedEvent *) &xev)->button&0xff) { case RightButton: event->eventType = EVENT_RIGHT_U; return; case LeftButton: event->eventType = EVENT_LEFT_U; return; } break; case Expose: repaintWindow(); break; case FocusIn: case MapNotify: mapped = TRUE; iconInverted = FALSE; flashIcon = FALSE; repaintIcon(); break; case FocusOut: case UnmapNotify: mapped = FALSE; break; } } if (FD_ISSET(socket, &fdmask)) { socklen_t fromLen = sizeof(event->eventSource); int cc; event->eventType = EVENT_NETWORK; cc = recvfrom(socket, (char*)event->eventDetail, sizeof(MW244BPacket), 0, (struct sockaddr *)&event->eventSource, &fromLen); if (cc <= 0) { if (cc < 0 && errno != EINTR) perror("event recvfrom"); continue; } if (fromLen != sizeof(struct sockaddr_in)) continue; ConvertIncoming(event->eventDetail); return; } } }
MRESULT EXPENTRY stlrTitleBarProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PSTLRFRAME p; /* ------------------------------------------------------------------- window creation : store the handle of the owner window, the initial titlebar size, convert the title substituting \r\n with 1 space, update the titlebar font ------------------------------------------------------------------- */ if (msg == WM_CREATE) { // if this is a global exception window, if the window ID is not // FID_TITLEBAR or if the owner window is not a frame, go to the // default system titlebar procedure if (!pd.ppib || (((PCREATESTRUCT)mp2)->id != FID_TITLEBAR) || !_isFrameWindow(((PCREATESTRUCT)mp2)->hwndOwner)) goto defaultTitlebarProcedure; // get the frame data p = (PSTLRFRAME)WinQueryWindowPtr(((PCREATESTRUCT)mp2)->hwndOwner, g.cd.frame.cbData); // /*-*/ dbgPrintf5("*** pd.ppib:%08x, id: %04x, isOwnerFrame: %d, p: %08x\n", // pd.ppib, ((PCREATESTRUCT)mp2)->id, // _isFrameWindow(((PCREATESTRUCT)mp2)->hwndOwner), p); // if the frame window is a win32frame initialize the frame data now if (!p || ((p == FL_WIN32FRAME) && (NULL == (p = _initWin32Frame(((PCREATESTRUCT)mp2)->hwndOwner))))) goto defaultTitlebarProcedure; // memorizza handle frame window WinSetWindowPtr(hwnd, g.cd.tbar.cbData, p); p->hTBar = hwnd; if (((PCREATESTRUCT)mp2)->pszText) p->cchTxt = psznconvcpy(p->achTxt, ((PCREATESTRUCT)mp2)->pszText, 260); p->wrclTitle.x = ((PCREATESTRUCT)mp2)->x; p->wrclTitle.y = ((PCREATESTRUCT)mp2)->y; p->wrclTitle.cx = ((PCREATESTRUCT)mp2)->cx; p->wrclTitle.cy = ((PCREATESTRUCT)mp2)->cy; // cambia font secondo preferenze if (o.tb.on && !(o.gen.disabled || pd.we.tbar)) _setPPFont(hwnd, o.tb.achFont); /* ------------------------------------------------------------------- hiliting/unhiliting of the titlebar : store the handle of the owner window, the initial titlebar size, convert the title substituting \r\n with 1 space, update the titlebar font ------------------------------------------------------------------- */ } else if (msg == TBM_SETHILITE) { if (_getFrameData(hwnd, p)) { p->is.tbhilited = (BOOL)mp1; if (!o.gen.disabled && o.tb.on && !pd.we.tbar) { if (o.tb.ovrPP || (p->is.tbhilited && !p->is.tbactpp) || !(p->is.tbhilited || p->is.tbictpp)) { if (WinIsWindowShowing(hwnd)) { p->hps = WinGetPS(hwnd); DrawTitlebar(p); WinReleasePS(p->hps); } /* endif */ return (MRESULT)TRUE; // Š solo apparentemente ridondante, in realt… Š necessario quando // non Š ovrPP ed Š presente solo PP att. o inatt. } else if (!(p->is.tbactpp && p->is.tbictpp)) { repaintWindow(hwnd); } /* endif */ } /* endif */ } /* endif */ /* ------------------------------------------------------------------- titlebar font/color changed - if the font changed repaint the window - if any color changed reset the presparm presence flag ------------------------------------------------------------------- */ } else if (msg == WM_PRESPARAMCHANGED) { if (!pd.we.tbar && _getFrameData(hwnd, p)) { ULONG ul; switch ((LONG)mp1) { case PP_FONTNAMESIZE: p->cyfont = 0; if (o.gen.disabled) break; if (WinIsWindowShowing(hwnd)) repaintWindow(hwnd); return (MRESULT)FALSE; case PP_ACTIVETEXTBGNDCOLOR: case PP_ACTIVETEXTBGNDCOLORINDEX: case PP_ACTIVECOLOR: case PP_ACTIVECOLORINDEX: p->is.tbactpp = _getPPColor(hwnd, (ULONG)mp1, &ul) != 0; break; case PP_INACTIVETEXTBGNDCOLOR: case PP_INACTIVETEXTBGNDCOLORINDEX: case PP_INACTIVECOLOR: case PP_INACTIVECOLORINDEX: p->is.tbictpp = _getPPColor(hwnd, (ULONG)mp1, &ul) != 0; break; } /* endswitch */ } /* endif */ /* ------------------------------------------------------------------- the titlebar text changed. If this is a Win-OS/2 window set the window words to 0 so that the enhancements are skipped, otherwise store the new text. ------------------------------------------------------------------- */ } else if (msg == WM_SETWINDOWPARAMS) { if (!pd.we.tbar && _getFrameData(hwnd, p)) { // unsubclass winOS2 windows titlebars if (p->is.winos2) { _resetDefaultProc(hwnd); // WinSetWindowULong(hwnd, g.cd.tbar.cbData, 0); } else { if ((PWNDPARAMS)mp1 && (((PWNDPARAMS)mp1)->fsStatus & WPM_TEXT) && ((PWNDPARAMS)mp1)->pszText) { p->cchTxt = psznconvcpy(p->achTxt, ((PWNDPARAMS)mp1)->pszText, 260); p->cyfont = 0; } /* endif */ } /* endif */ } /* endif */ /* ------------------------------------------------------------------- titlebar size/position changed : store new size and position ------------------------------------------------------------------- */ } else if (msg == WM_WINDOWPOSCHANGED) { if ((((PSWP)mp1)->fl & (SWP_SIZE | SWP_MOVE)) && _getFrameData(hwnd, p)) { p->wrclTitle.x = ((PSWP)mp1)->x; p->wrclTitle.y = ((PSWP)mp1)->y; p->wrclTitle.cx = ((PSWP)mp1)->cx; p->wrclTitle.cy = ((PSWP)mp1)->cy; } /* endif */ // ************************************************************************** // these messages are processed only if Styler/2 is not disabled: } else if (!o.gen.disabled) { /* ------------------------------------------------------------------- check if this is the roll-the-window mouse event : ------------------------------------------------------------------- */ if ((msg == o.roll.moumsg) && (SHORT2FROMMP(mp2) == o.roll.moukbd)) { if (!pd.we.wroll && o.roll.mou && _getFrameData(hwnd, p) && !p->is.win32 && (o.roll.on || p->is.RLon)) { toggleRollCmd(p->hwnd, p); return (MRESULT)TRUE; } /* endif */ /* ------------------------------------------------------------------- check if this is the hide-titlebar mouse event : ------------------------------------------------------------------- */ } else if ((msg == o.tbh.moumsg) && (SHORT2FROMMP(mp2) == o.tbh.moukbd)) { if (!pd.we.tbarhide && o.tbh.mou && _getFrameData(hwnd, p) && !p->is.win32 // opzione titlehide attiva e non dialogo o disattivazione titlehide && ((o.tbh.on && !(p->is.dialog && o.tbh.noDlg)) || p->is.titleHide)) { toggleTitleBarHidingCmd(p->hwnd, p); return (MRESULT)TRUE; } /* endif */ /* ------------------------------------------------------------------- check if this is the change-Zorder mouse event : ------------------------------------------------------------------- */ } else if ((msg == o.sizpos.ZordMoumsg) && (SHORT2FROMMP(mp2) == o.sizpos.ZordMoukbd)) { if (!pd.we.sizemove && o.sizpos.Zmove && _getFrameData(hwnd, p)) { _stlrMsgPost(p->hwnd, STLR_ZORDACTIV, SW2_SFMOVETOBOTTOM); return (MRESULT)TRUE; } /* endif */ /* ------------------------------------------------------------------- check if this is the snap-to-screen-edge mouse event : ------------------------------------------------------------------- */ } else if ((msg == o.sizpos.snapMoumsg) && (SHORT2FROMMP(mp2) == o.sizpos.snapMoukbd)) { if (!pd.we.sizemove && o.sizpos.snap && _getFrameData(hwnd, p)) { // get the rectangle of the window and of its parent RECTL r, rParent; WinQueryWindowRect(p->hwnd, &r); WinQueryWindowRect(_winParent(p->hwnd), &rParent); // click on the left side of the titlebar if (MOUSEX(mp1) < (p->wrclTitle.cx / 3)) { r.xLeft = -p->ptBrd.x; // click on the right side of the titlebar } else if (MOUSEX(mp1) > (p->wrclTitle.cx * 2 / 3)) { r.xLeft = rParent.xRight - r.xRight + p->ptBrd.x; // click on the (horizontal) middle of the titlebar } else { r.xLeft = (rParent.xRight - r.xRight) / 2; } /* endif */ // click on the bottom of the titlebar if (MOUSEY(mp1) < (g.sys.cyTbar / 3)) { r.yBottom = -p->ptBrd.y; // click on the top of the titlebar } else if (MOUSEY(mp1) > (g.sys.cyTbar * 2 / 3)) { r.yBottom = rParent.yTop - r.yTop + p->ptBrd.y; // click on the (vertical) middle of the titlebar } else { r.yBottom = (rParent.yTop - r.yTop) / 2; } /* endif */ WinSetWindowPos(p->hwnd, 0, r.xLeft, r.yBottom, 0, 0, SWP_MOVE | SWP_NOADJUST); } /* endif */ /* ------------------------------------------------------------------- enhanced window painting ------------------------------------------------------------------- */ } else if (msg == WM_PAINT) { if (!pd.we.tbar && o.tb.on && _getFrameData(hwnd, p) && (o.tb.ovrPP || (p->is.tbhilited && !p->is.tbactpp) || !(p->is.tbhilited || p->is.tbictpp))) { p->hps = WinBeginPaint(hwnd, NULLHANDLE, NULL); DrawTitlebar(p); WinEndPaint(p->hps); return (MRESULT)FALSE; } /* endif */ /* ------------------------------------------------------------------- override the default window tracking : ------------------------------------------------------------------- */ } else if ((msg == WM_BUTTON1DOWN) || (msg == WM_BUTTON2DOWN)) { if (_getFrameData(hwnd, p)) { // override window motion by titlebar drag : // store the current mouse position (mp1) // the window motion will start only when the mouse will move g.tbdrag.mpPos = mp1; // if the window is not already moving store which mouse button // has to be released to stop the titlebar drag if (!g.tbdrag.hwnd) g.tbdrag.msg = ++msg; // store the handle of the titlebar (mouse motion events are not // processed when this is NULLHANDLE) g.tbdrag.hwnd = hwnd; // cattura i msg successivi del mouse WinSetCapture(HWND_DESKTOP, hwnd); return (MRESULT)TRUE; } /* endif */ /* ------------------------------------------------------------------- terminate window motion through titlebar drag events : ------------------------------------------------------------------- */ } else if ((msg == WM_BUTTON1UP) || (msg == WM_BUTTON2UP)) { if ((g.tbdrag.hwnd == hwnd) && (g.tbdrag.msg == msg) && _getFrameData(hwnd, p)) { HWND hwndParent; WinSetCapture(HWND_DESKTOP, NULLHANDLE); g.tbdrag.msg = 0; g.tbdrag.hwnd = NULLHANDLE; // if the Ctrl key is not pressed and the window is not yet active // end the window is a size-move feature exception or the event // is not related to the Z-order motion feature or the snap-to- // parent-edge feature activate the window bringing it to the top if (!(SHORT2FROMMP(mp2) & KC_CTRL) && (g.hwnd.active != p->hwnd) && (pd.we.sizemove || (!(o.sizpos.Zmove && (msg == (o.sizpos.ZordMoumsg - 0x3a1)) && (SHORT2FROMMP(mp2) == o.sizpos.ZordMoukbd)) && (!(o.sizpos.snap && (msg == (o.sizpos.snapMoumsg - 0x3a1)) && (SHORT2FROMMP(mp2) == o.sizpos.snapMoukbd)))))) WinSetWindowPos(p->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); } /* endif */ /* ------------------------------------------------------------------- open the system menu on the titlebar : ------------------------------------------------------------------- */ } else if (msg == WM_CONTEXTMENU) { if (!pd.we.tbar && o.tb.menu && _getFrameData(hwnd, p)) { // if this is the titlebar of a WPS folder simulate a context // menu event on the client window if (p->is.folder) { p->hClient = WinWindowFromID(p->hwnd, FID_CLIENT); WinPostMsg(p->hClient, WM_CONTEXTMENU, (MPARAM)0x7fff7fff, MPVOID); // otherwise get the handle of the system menu and bring it to // the top via WinPopupMenu() } else if (p->hSMenu) { POINTL ptl; WinQueryPointerPos(g.hwnd.desktop, &ptl); g.cd.menu.pfnwp(p->hSMenu, MM_QUERYITEM, (MPARAM)SC_SYSMENU, MPFROMP(&p->mi)); g.hwnd.sysMenu = p->mi.hwndSubMenu; WinPopupMenu(g.hwnd.desktop, p->hSMenu, g.hwnd.sysMenu, ptl.x, ptl.y, 0, PU_HCONSTRAIN | PU_VCONSTRAIN | PU_NONE | PU_KEYBOARD | PU_MOUSEBUTTON1); } /* endif */ } /* endif */ return (MRESULT)TRUE; /* ------------------------------------------------------------------- trap WM_MOUSEMOVE to implement various features : - do not move maximized windows ------------------------------------------------------------------- */ } else if (msg == WM_MOUSEMOVE) { // if mouse button 1 or 2 were pressed and then the mouse position // changed if ((g.tbdrag.hwnd == hwnd) && (g.tbdrag.mpPos != mp1) && _getFrameData(hwnd, p)) { WinSetCapture(HWND_DESKTOP, NULLHANDLE); g.tbdrag.hwnd = NULLHANDLE; g.tbdrag.msg = 0; // if this is a maximized window and the don't-move-max-window // feature is set ignore the event if (o.maxwin.nomove && p->is.max && !(pd.we.maxwin || p->is.shield || p->is.ovrdnomovemax)) return (MRESULT)TRUE; WinSendMsg(p->hwnd, WM_TRACKFRAME, (MPARAM)TF_MOVE, g.tbdrag.mpPos); // ??????????????????????????????? // this is needed because the next WM_BUTTONxUP is captured by // the WM_TRACKFRAME processing // if (!(SHORT2FROMMP(mp2) & KC_CTRL)) // WinSetWindowPos(p->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); return (MRESULT)TRUE; } else if (g.is.onctrl != OCTLTBAR) { g.is.onctrl = OCTLTBAR; // ??????????????? this should be redundant // _resetHideMouTimer(); } /* endif */ } /* endif */ // ------------------------------------------------------------------- } /* endif */ defaultTitlebarProcedure: return g.cd.tbar.pfnwp(hwnd, msg, mp1, mp2); }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window (low priority) // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; // tu podajesz jaki obszar ma sie odswiezac RECT rect = { 500, 800, 800, 500 }; switch (message) { case WM_KEYDOWN: { switch (wParam) { case VK_LEFT: { steering = -1; choose_arm = 1; repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; } case VK_RIGHT: { steering = +1; choose_arm = 1; repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; } case VK_UP: { steering = -1; choose_arm = 2; repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; } case VK_DOWN: { steering = 1; choose_arm = 2; repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; } case VK_F1: { if (kulay1 + R >= floory1) { KillTimer(hWnd, TMR_1); break; } SetTimer(hWnd, TMR_1, 25, 0); break; } break; } } case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // MENU & BUTTON messages // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; case ID_BUTTON1: col++; if (col > 10) col = 0; repaintWindow(hWnd, hdc, ps, &drawArea1); break; case ID_BUTTON2: repaintWindow(hWnd, hdc, ps, NULL); break; case ID_BUTTON3: repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; case ID_BUTTON4: repaintARM(hWnd, hdc, ps, NULL); b0ss++; break; case ID_BUTTON5: SetTimer(hWnd, TMR_1, 25, 0); b0ss++; break; case ID_RBUTTON1: SetTimer(hWnd, TMR_1, 25, 0); break; case ID_RBUTTON2: KillTimer(hWnd, TMR_1); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here (not depend on timer, buttons) EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_TIMER: switch (wParam) { case TMR_1: if (kulay1 + R >= floory1) KillTimer(hWnd, TMR_1); //force window to repaint repaintWindow(hWnd, hdc, ps, NULL); time++; break; } default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
int CALLBACK ButtonX::windowProc(HWND hwnd , int message , WPARAM wParam, LPARAM lParam) { switch(message) { case WM_SETTEXT: ButtonX::fromHWND(hwnd)->_text = (char*) lParam; //break; return 0; case WM_GETTEXT: if (ButtonX::fromHWND(hwnd)->_duringPaint) { ((char*)lParam)[0] = 0; return 0; } //break; // strncpy((char*) lParam,ButtonX::fromHWND(hwnd)->_text , wParam); strncpy((char*) lParam,ButtonX::fromHWND(hwnd)->_text , wParam); return min(ButtonX::fromHWND(hwnd)->_text.length(), wParam-1); case WM_GETTEXTLENGTH: if (ButtonX::fromHWND(hwnd)->_duringPaint) return 0; //break; return ButtonX::fromHWND(hwnd)->_text.length(); case WM_PAINT: { ButtonX * bt = ButtonX::fromHWND(hwnd); //if (!bt->_icon) break; // standardowa obs³uga... //int r = 1; HRGN hrgn=CreateRectRgn(0, 0, 0, 0); bt->_duringPaint=true; GetUpdateRgn(hwnd, hrgn, false); int r = 1; if (!bt->isFlat()) { r = CallWindowProc(ButtonX::buttonClassProc, hwnd, message, wParam, lParam); } InvalidateRgn(hwnd, hrgn, false); PAINTSTRUCT ps; HDC hdc; hdc = BeginPaint(hwnd, &ps); if (bt->isFlat()) { FillRgn(hdc, hrgn, GetSysColorBrush(COLOR_BTNFACE)); } RECT rc = {0,0,0,0}; bt->drawCaption(hdc, rc); EndPaint(hwnd, &ps); bt->_duringPaint=false; DeleteObject(hrgn); return r;} case WM_ENABLE: case WM_UPDATEUISTATE: { int r = CallWindowProc(ButtonX::buttonClassProc, hwnd, message, wParam, lParam); repaintWindow(hwnd); return r;} case WM_ERASEBKGND: return 0; case WM_SETFOCUS: //case BM_SETSTYLE: case BM_SETSTATE: // specjalnie dla W98 repaintWindow(hwnd); break; case WM_SETCURSOR: if (fromHWND(hwnd)->isFlat()) { SetCursor( LoadCursor(0, IDC_HAND) ); return true; } break; #ifndef STAMINA_KISS case WM_LBUTTONDOWN: { ButtonX* b = fromHWND(hwnd); S_ASSERT(b); b->_pressed = true; b->evtMouseDown(b, wParam); break;} case WM_LBUTTONUP: { ButtonX* b = fromHWND(hwnd); S_ASSERT(b); if (b->_pressed) { b->evtMouseUp(b, wParam); if (getClientRect(hwnd).contains(Point::fromLParam(lParam))) { b->evtClick(b); } } b->_pressed = false; break;} case WM_LBUTTONDBLCLK: { //SendMessage(hwnd, BM_CLICK, 0, 0); ButtonX* b = fromHWND(hwnd); S_ASSERT(b); b->evtMouseDown(b, wParam); b->evtMouseUp(b, wParam); b->evtClick(b); break;} case WM_MOUSELEAVE: //fromHWND(hwnd)->_pressed = false; break; case WM_MOUSEMOVE: _tipTarget->attachButton(fromHWND(hwnd)); ToolTipX::mouseMovement(GetParent(hwnd)); //if (wParam == MK_LBUTTON) { // fromHWND(hwnd)->_pressed = true; //} break; #endif case WM_DESTROY: delete ButtonX::fromHWND(hwnd); break; }; return CallWindowProc(ButtonX::buttonClassProc, hwnd, message, wParam, lParam); }
void ButtonX::setText(const CStdString& text) { this->_text = text; repaintWindow(_hwnd); }
void keyUp(char character, int virtualKey) { _pressedChar = 0; repaintWindow(); }
void timerTick() { _secondElapsed++; repaintWindow(); }