| 380 | } |
| 381 | |
| 382 | LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) |
| 383 | { |
| 384 | switch (Message) |
| 385 | { |
| 386 | // Custom window message to change tab control style on the fly |
| 387 | case WM_TABSETSTYLE: |
| 388 | { |
| 389 | //::SendMessage(upDownWnd, UDM_SETBUDDY, NULL, 0); |
| 390 | auto style = ::GetWindowLongPtr(hwnd, GWL_STYLE); |
| 391 | |
| 392 | if (wParam > 0) |
| 393 | style |= lParam; |
| 394 | else |
| 395 | style &= ~lParam; |
| 396 | |
| 397 | _isVertical = ((style & TCS_VERTICAL) != 0); |
| 398 | _isMultiLine = ((style & TCS_MULTILINE) != 0); |
| 399 | |
| 400 | ::SetWindowLongPtr(hwnd, GWL_STYLE, style); |
| 401 | ::InvalidateRect(hwnd, NULL, true); |
| 402 | |
| 403 | return true; |
| 404 | } |
| 405 | |
| 406 | case WM_LBUTTONDOWN : |
| 407 | { |
| 408 | if (_drawTabCloseButton) |
| 409 | { |
| 410 | int xPos = LOWORD(lParam); |
| 411 | int yPos = HIWORD(lParam); |
| 412 | |
| 413 | if (_closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect)) |
| 414 | { |
| 415 | _whichCloseClickDown = getTabIndexAt(xPos, yPos); |
| 416 | ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_REFRESHTABAR, 0); |
| 417 | return true; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | ::CallWindowProc(_tabBarDefaultProc, hwnd, Message, wParam, lParam); |
| 422 | int currentTabOn = static_cast<int> (::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0)); |
| 423 | |
| 424 | if (wParam == 2) |
| 425 | return true; |
| 426 | |
| 427 | if (_doDragNDrop) |
| 428 | { |
| 429 | _nSrcTab = _nTabDragged = currentTabOn; |
| 430 | |
| 431 | POINT point; |
| 432 | point.x = LOWORD(lParam); |
| 433 | point.y = HIWORD(lParam); |
| 434 | ::ClientToScreen(hwnd, &point); |
| 435 | if(::DragDetect(hwnd, point)) |
| 436 | { |
| 437 | // Yes, we're beginning to drag, so capture the mouse... |
| 438 | _isDragging = true; |
| 439 | ::SetCapture(hwnd); |