xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Menu.cpp File Reference
#include "MenuCommon.h"
#include "Menu.h"
#include "MenuItem.h"
#include "PreviewItem.h"
#include "StringItem.h"
#include "..\API\BBApi.h"
#include "..\Settings\Settings.h"
#include <algorithm>

Functions

LRESULT CALLBACK MenuWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

const char szMenuName [] = "BBMenu"
 
BImagepBImage
 
SettingspSettings
 
MenuCommonpMenuCommon
 
PreviewItempPreviewItem
 
vector< Menu * > g_Menues
 
int menuMessageSubscription [] = { BB_RECONFIGURE, BB_REDRAWGUI, 0 }
 

Function Documentation

◆ MenuWindowProc()

LRESULT CALLBACK MenuWindowProc ( HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam )
1522{
1523 POINT point;
1524 Menu* p = NULL;
1525 LRESULT ret = 0;
1526
1527 //====================
1528
1529 // Find the menu that should receive the message...
1530 for (unsigned int i=0; i < g_Menues.size(); i++)
1531 {
1532 if (hwnd == g_Menues[i]->GetWindow())
1533 {
1534 p = g_Menues[i];
1535 break;
1536 }
1537 }
1538
1539 // Return DefWindowProc if no matching menu could be found...
1540 if (p == NULL) return DefWindowProc(hwnd, uMsg, wParam, lParam);
1541 // ...or if the receiving menu is not validated...
1542// if (!p->isValidated) return DefWindowProc(hwnd, uMsg, wParam, lParam);
1543
1544 //====================
1545
1546 if (uMsg >= WM_USER) // Nb. this includes messages such as BB_DESKTOPINFO etc
1547 {
1548 LRESULT lResult = 0;
1549
1550 if (p->OnUser((int) uMsg, wParam, lParam, lResult)) return lResult;
1551 }
1552
1553 //====================
1554
1555 switch (uMsg)
1556 {
1557 case WM_NCHITTEST:
1558 {
1559/*
1560 point.x = GET_X_LPARAM(lParam);
1561 point.y = GET_Y_LPARAM(lParam);
1562 ScreenToClient(hwnd, &point);
1563 ret = p->NcHitTest(point.x, point.y);
1564 if (ret == 0) ret = HTCLIENT;
1565*/
1566 if (!p->isValidated) return HTCLIENT;
1567
1568 GetCursorPos(&point);
1569 ScreenToClient(hwnd, &point);
1570 RECT r;
1571 GetClientRect(hwnd, &r);
1572 r.top += pMenuCommon->m_nTitleHeight;
1573 r.bottom -= pMenuCommon->m_nGripHeight;
1574 r.left += pSettings->MenuFrame->borderWidth;
1575 r.right -= pSettings->MenuFrame->borderWidth;
1576
1577 if (!PtInRect(&r, point))
1578 {
1579// if (!p->GetParent() || p->IsPinned()) return HTCAPTION;
1580 return HTCAPTION; // -> PRELIMINARY: Allow dragging away submenus from its parent without prior pinning == subject to change/reversal pending any negative side-effects
1581 }
1582
1583 return HTCLIENT;
1584 }
1585 break;
1586
1587 //====================
1588
1589 case WM_NCMOUSEMOVE:
1590 {
1591 if (!pSettings->menuEditboxAlreadyActive && !p->keyboardNavigationInProgress)
1592 {
1593 point.x = GET_X_LPARAM(lParam);
1594 point.y = GET_Y_LPARAM(lParam);
1595 ScreenToClient(hwnd, &point);
1596 p->Mouse(WM_MOUSEMOVE, point.x, point.y);
1597 }
1598
1599 return 0;
1600 }
1601 break;
1602
1603 //====================
1604
1605 case WM_NCLBUTTONUP:
1606 case WM_NCRBUTTONUP:
1607 case WM_NCMBUTTONUP: // Midclick on title items -> Pin/Unpin menu
1608 case WM_NCLBUTTONDBLCLK: // Doubleclick on title items -> Pin/Unpin menu
1609 {
1610 point.x = GET_X_LPARAM(lParam);
1611 point.y = GET_Y_LPARAM(lParam);
1612 ScreenToClient(hwnd, &point);
1613 p->Mouse(uMsg, point.x, point.y);
1614 return 0;
1615 }
1616 break;
1617/*
1618 case WM_NCLBUTTONDOWN:
1619 case WM_NCRBUTTONDOWN:
1620 case WM_NCMBUTTONDOWN:
1621 {
1622 return DefWindowProc(hwnd, uMsg, wParam, lParam);
1623 }
1624 break;
1625*/
1626 //====================
1627
1628 case WM_MOUSEMOVE:
1629 {
1630 if (!pSettings->menuEditboxAlreadyActive)
1631 {
1632 // Hack to make keyboard navigation work
1633 // when the mouse is above the window...
1634 static int lastX = 0;
1635 static int lastY = 0;
1636
1637 if (lastX == GET_X_LPARAM(lParam) && lastY == GET_Y_LPARAM(lParam))
1638 return 0;
1639
1640 lastX = GET_X_LPARAM(lParam);
1641 lastY = GET_Y_LPARAM(lParam);
1642
1643 p->Mouse(uMsg, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
1644 }
1645
1646 return 0;
1647 }
1648 break;
1649
1650 //====================
1651
1652 case WM_LBUTTONUP:
1653 case WM_RBUTTONUP:
1654 case WM_MBUTTONUP:
1655 case WM_LBUTTONDOWN:
1656 case WM_RBUTTONDOWN:
1657 case WM_MBUTTONDOWN:
1658 case WM_LBUTTONDBLCLK:
1659 {
1660 p->Mouse(uMsg, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
1661 return 0;
1662 }
1663 break;
1664
1665 //====================
1666
1667 case WM_EXITSIZEMOVE:
1668 {
1669 RECT r;
1670 GetWindowRect(p->GetWindow(), &r);
1671 p->menuX = r.left;
1672 p->menuY = r.top;
1673 return 0;
1674 }
1675 break;
1676
1677 //====================
1678
1679 case WM_MOUSEWHEEL:
1680 {
1681 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) p->Mouse(uMsg, 0, 0);
1682 else p->Mouse(uMsg, 1, 0);
1683 return 0;
1684 }
1685 break;
1686
1687 // case WM_MOUSEHWHEEL: { } break;
1688
1689 //====================
1690
1691 case WM_KEYDOWN: // -> Allow keyboard navigation when the menu is the foreground window...
1692 {
1694 KillTimer(p->GetWindow(), MENU_TRACK_MOUSE_TIMER);
1695
1696 switch(wParam)
1697 {
1698 case VK_DOWN: // Move to the next menu item
1699 case VK_UP: // Move to the previous menu item
1700 case VK_RIGHT: // Enter submenu (if the menu item is a folder item)
1701 case VK_LEFT: // Return from submenu (moving back to the parent menu)
1702 case VK_HOME: // Jump to the first menu item
1703 case VK_END: // Jump to the last menu item
1704 case VK_SPACE: // Simulate a *right* click on command, boolean or string editing items, keeping the menu open.
1705 case VK_RETURN: // Simulate a *left* click on command items, closing the menu.
1706 case VK_PRIOR: // (PageUp) Increase the value of integer editing menu items
1707 case VK_ADD: // (NumPad Add) ...
1708 case VK_NEXT: // (PageDown) Decrease the value of integer editing menu items
1709 case VK_SUBTRACT: // (NumPad Subtract) ...
1710 {
1711 MENUITERATOR i1, i2;
1712 Menu* m = NULL;
1713
1714 if (wParam == VK_HOME) // -> Jump to the first menu item!
1715 {
1716 pMenuCommon->FindActiveAndDeactivate(p, false);
1717 if (pPreviewItem) pPreviewItem->Hide();
1718
1719 int screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1720 int screenY = GetSystemMetrics(SM_YVIRTUALSCREEN);
1721 if (p->menuHeight > screenHeight) p->menuY = screenY; // -> Scroll to the top if the menu is taller than the screen...
1722
1723 i1 = p->m_MenuItems.begin() + 2; // -> Skip MENUITEM_HEADER (i.e. menu title item) and first MENUITEM_MARGINPAD (i.e. padding in between the menu title and frame)
1724 (*i1)->Active(true);
1725
1726 if ((*i1)->itemType != MENUITEM_FOLDER) PlaySoundFX(SFX_MENU_NAVIGATE);
1727 }
1728 else if (wParam == VK_END) // -> Jump to the last menu item!
1729 {
1730 pMenuCommon->FindActiveAndDeactivate(p, false);
1731 if (pPreviewItem) pPreviewItem->Hide();
1732
1733 int screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1734 if (p->menuHeight > screenHeight) p->menuY = screenHeight - p->menuHeight; // -> Scroll to the bottom if the menu is taller than the screen...
1735
1736 i1 = p->m_MenuItems.end() - 3; // -> Skip MENUITEM_FOOTER (i.e. menu grip or non-visible footer item) and last MENUITEM_MARGINPAD (i.e. padding in between the menu frame and footer/grip)
1737 (*i1)->Active(true);
1738
1739 if ((*i1)->itemType != MENUITEM_FOLDER) PlaySoundFX(SFX_MENU_NAVIGATE);
1740 }
1741 else
1742 {
1743 bool activeFound = false;
1744 for (i1 = p->m_MenuItems.begin(); i1 != p->m_MenuItems.end(); i1++)
1745 {
1746 if ((*i1)->IsActive())
1747 {
1748 m = (*i1)->m_pParent;
1749 activeFound = true;
1750 break;
1751 }
1752 }
1753
1754 if (!activeFound)
1755 {
1756 i1 = p->m_MenuItems.begin();
1757 i1++; // Skip MENUITEM_HEADER (i.e. menu title item)
1758 i1++; // Skip first MENUITEM_MARGINPAD (i.e. padding in between the menu title and frame)
1759 (*i1)->Active(true);
1760 }
1761 else
1762 {
1763 i2 = i1;
1764
1765 if (wParam == VK_DOWN)
1766 {
1767 while (i2 < p->m_MenuItems.end()-2)
1768 {
1769 i2++;
1770 if ((*i2)->m_pParent == m)
1771 {
1772 if ((*i2)->itemType != MENUITEM_SEPARATOR && (*i2)->itemType != MENUITEM_MARGINPAD && (*i2)->itemType != MENUITEM_FOOTER)
1773 {
1774 (*i1)->Active(false);
1775 if (pPreviewItem) pPreviewItem->Hide();
1776
1777 // Allow menu scrolling if the menu is taller than the screen...
1778 int screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1779 if (p->menuHeight > screenHeight)
1780 {
1781 p->menuY -= pMenuCommon->m_nSubmenuHeight;
1782 if ((p->menuY + p->menuHeight) < screenHeight) p->menuY = screenHeight - p->menuHeight;
1783 }
1784
1785 (*i2)->Active(true);
1786
1787 if ((*i2)->itemType != MENUITEM_FOLDER) PlaySoundFX(SFX_MENU_NAVIGATE);
1788 break;
1789 }
1790 }
1791 }
1792 }
1793 else if (wParam == VK_UP)
1794 {
1795 while (i2 > p->m_MenuItems.begin()+2)
1796 {
1797 i2--;
1798 if ((*i2)->m_pParent == m)
1799 {
1800 if ((*i2)->itemType != MENUITEM_SEPARATOR && (*i2)->itemType != MENUITEM_MARGINPAD && (*i2)->itemType != MENUITEM_HEADER)
1801 {
1802 (*i1)->Active(false);
1803 if (pPreviewItem) pPreviewItem->Hide();
1804
1805 // Allow menu scrolling if the menu is taller than the screen...
1806 int screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1807 if (p->menuHeight > screenHeight)
1808 {
1809 p->menuY += pMenuCommon->m_nSubmenuHeight;
1810 int screenY = GetSystemMetrics(SM_YVIRTUALSCREEN);
1811 if (p->menuY > screenY) p->menuY = screenY;
1812 }
1813
1814 (*i2)->Active(true);
1815
1816 if ((*i2)->itemType != MENUITEM_FOLDER) PlaySoundFX(SFX_MENU_NAVIGATE);
1817 break;
1818 }
1819 }
1820 }
1821 }
1822 else if (wParam == VK_RIGHT)
1823 {
1824 if ((*i1)->itemType == MENUITEM_FOLDER)
1825 {
1826 FolderItem* item = (FolderItem*)*i1;
1827 item->ShowSubMenu();
1828 SetForegroundWindow((*i1)->m_pSubMenu->GetWindow());
1829 SendMessage((*i1)->m_pSubMenu->GetWindow(), WM_KEYDOWN, VK_HOME, NULL);
1830 return 0;
1831 }
1832 }
1833 else if (wParam == VK_LEFT)
1834 {
1835 if ((*i1)->m_pParent->GetParent() != NULL)
1836 {
1837 (*i1)->Active(false);
1838 (*i1)->m_pParent->Hide(HIDE_THIS);
1839 if (pPreviewItem) pPreviewItem->Hide();
1840 Menu* parentMenu = (*i1)->m_pParent->GetParent();
1841 SetForegroundWindow(parentMenu->GetWindow());
1843 }
1844 }
1845 else if (wParam == VK_SPACE)
1846 {
1847 if (((*i1)->itemType == MENUITEM_COMMAND) || ((*i1)->itemType == MENUITEM_BOOLEAN) || ((*i1)->itemType == MENUITEM_EDITSTRING)) (*i1)->Invoke(2); // -> Simulating a *right* click on command, boolean or string editing items, keeping the menu open...
1848 return 0;
1849 }
1850 else if (wParam == VK_RETURN)
1851 {
1852 if (((*i1)->itemType == MENUITEM_COMMAND)) (*i1)->Invoke(1); // -> Simulating a *left* click on command items, closing the menu.
1853 return 0;
1854 }
1855 else if ((wParam == VK_PRIOR) || (wParam == VK_ADD))
1856 {
1857 if ((*i1)->itemType == MENUITEM_EDITINT)
1858 {
1859 POINT pt;
1860 pt.x = (*i1)->m_nLeft + (*i1)->m_nWidth - 1; // Simulating a mouse click on the right hand side of the menu item -> Increase value!
1861 pt.y = (*i1)->m_nTop;
1862 (*i1)->Mouse(WM_LBUTTONUP, pt);
1863 return 0;
1864 }
1865 }
1866 else if ((wParam == VK_NEXT) || (wParam == VK_SUBTRACT))
1867 {
1868 if ((*i1)->itemType == MENUITEM_EDITINT)
1869 {
1870 POINT pt;
1871 pt.x = (*i1)->m_nLeft + 1; // Simulating a mouse click on the left hand side of the menu item -> Decrease value!
1872 pt.y = (*i1)->m_nTop;
1873 (*i1)->Mouse(WM_LBUTTONUP, pt);
1874 return 0;
1875 }
1876 }
1877 }
1878 }
1879
1880// p->UpdateMenuWindow();
1881 return 0;
1882 }
1883 break;
1884
1885 case VK_INSERT: // Toggle menu pinned
1886 {
1887// if (!p->isPinned) p->isPinned = true;
1888// else p->isPinned = false;
1889// p->UpdateMenuWindow();
1890 p->TogglePinned();
1891 return 0;
1892 }
1893 break;
1894
1895 case VK_ESCAPE: // Close the menu
1896 case VK_DELETE:
1897 {
1898 if (pPreviewItem) pPreviewItem->Hide();
1899 if (pMenuCommon) pMenuCommon->Hide();
1900 return 0;
1901 }
1902 break;
1903
1904 default: { return 0; }
1905 }
1906 }
1907 break;
1908
1909 //====================
1910
1911 case WM_CHAR: // -> Allow keyboard search on the *first* character of menu item titles when the menu is the foreground window...
1912 {
1914 KillTimer(p->GetWindow(), MENU_TRACK_MOUSE_TIMER);
1915
1916 char typeAhead = tolower((char)wParam); // If applicable, use the lowercase version of the character...
1917
1918 MENUITERATOR i;
1919 bool activeFound = false, searchFound = false;
1920
1921 for (i = p->m_MenuItems.begin()+2; i != p->m_MenuItems.end()-2; i++) // Skip MENUITEM_HEADER/MARGINPAD/FOOTER items...
1922 {
1923 if (!activeFound)
1924 {
1925 // Skip up to the currently active menu item... (i.e. accept any *following* match)
1926 if ((*i)->IsActive()) activeFound = true;
1927 continue;
1928 }
1929
1930 if (((tolower((*i)->m_pszTitleANSI[0]) == typeAhead)))
1931 {
1932 searchFound = true;
1933 pMenuCommon->ScrollToItem(p, (*i));
1934 break;
1935 }
1936 }
1937
1938 if (!searchFound)
1939 {
1940 for (i = p->m_MenuItems.begin()+2; i != p->m_MenuItems.end()-2; i++) // Skip MENUITEM_HEADER/MARGINPAD/FOOTER items...
1941 {
1942 if (((tolower((*i)->m_pszTitleANSI[0]) == typeAhead))) // Accept *any* match...
1943 {
1944 pMenuCommon->ScrollToItem(p, (*i));
1945 break;
1946 }
1947 }
1948 }
1949
1950 return 0;
1951 }
1952
1953 //====================
1954
1955 case WM_CLOSE:
1956 return 0;
1957
1958 //====================
1959
1960 case WM_ACTIVATE:
1961 {
1962 p->Activate(LOWORD(wParam), (HWND)lParam);
1963 }
1964 break;
1965
1966 //====================
1967
1968 case WM_TIMER:
1969 {
1970 p->Timer(wParam);
1971 return 0;
1972 }
1973 break;
1974
1975 //====================
1976
1977 case WM_MOVING:
1978 {
1979 p->Moving();
1980 }
1981 break;
1982
1983 //====================
1984/*
1985 case WM_WINDOWPOSCHANGING:
1986 {
1987 if (IsWindowVisible(hwnd)) SnapWindowToEdge((WINDOWPOS*)lParam, pSettings->edgeSnapThreshold, true);
1988 }
1989 break;
1990*/
1991 //====================
1992/*
1993 case WM_ERASEBKGND:
1994 return true;
1995*/
1996 //====================
1997
1998 case WM_COMMAND:
1999 {
2000 if (pSettings->menuEditboxAlreadyActive)
2001 {
2002// char msg[300];
2003// if (HIWORD(wParam) == EN_CHANGE) sprintf(msg, "Menu -> WM_COMMAND -> EN_CHANGE received...");
2004// else if (HIWORD(wParam) == EN_UPDATE) sprintf(msg, "Menu -> WM_COMMAND -> EN_UPDATE received...");
2005// else sprintf(msg, "Menu -> WM_COMMAND -> Unknown message received... -> 0x%x", (int)wParam);
2006// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
2007 return 0;
2008 }
2009 else p->Command(wParam, lParam);
2010 }
2011 break;
2012
2013 //====================
2014
2015 case WM_MOUSELEAVE:
2016 {
2017 p->MouseLeave();
2018 }
2019 break;
2020
2021 //====================
2022/*
2023 case WM_DROPFILES:
2024 {
2025 static TCHAR source[MAX_LINE_LENGTH];
2026 DragQueryFile((HDROP)wParam, 0, source, sizeof(source));
2027 DragFinish((HDROP)wParam);
2028
2029 RECT r;
2030 MENUITERATOR item;
2031 for (item = p->m_MenuItems.begin(); item != p->m_MenuItems.end() && !p->m_MenuItems.empty(); item++)
2032 {
2033 POINT mousepos;
2034 GetCursorPos(&mousepos);
2035 ScreenToClient(hwnd, &mousepos);
2036 (*item)->GetItemRect(&r);
2037
2038 if (PtInRect(&r, mousepos) && (*item)->itemType == MENUITEM_COMMAND)
2039 {
2040 if (!strlen((*item)->m_pszArgument)) break;
2041
2042 char destination[MAX_PATH];
2043 strcpy(destination, (*item)->m_pszArgument);
2044 if (destination[0] == '\"') StrRemoveEncap(destination);
2045 if (destination[1] == ':')
2046 {
2047 if (source[0] == '\"') StrRemoveEncap(source);
2048 char tempSource[MAX_PATH];
2049 strcpy(tempSource, source);
2050 int n = GetParentFolder(tempSource);
2051
2052 GetParentFolder(destination);
2053 strcat(destination, &source[n]);
2054
2055 // Move file from the source folder to the destination folder...
2056 MoveFile(source, destination);
2057
2058 // Look for a line that should "always" exist in a style file; if it
2059 // does we create a [style] menu item, otherwise an [exec] menu item...
2060 char cmd[8];
2061 if (strlen(ReadString(destination, "menu.frame", ""))) strcpy(cmd, "[style]");
2062 else strcpy(cmd, "[exec]");
2063
2064 // Create a new menu item for the moved file in the destination menu...
2065 // (note that this new menu item gets added *after* the bottom items,
2066 // so we need to sort the menu items afterwards)...
2067 pMenuCommon->CreateMenuItem(p, MENUITEM_COMMAND, cmd, destination, &source[n], false);
2068 p->Sort(2,0); // Skip the header item and top marginWidth padding item...
2069
2070 // Recalculate menu dimensions and redraw window...
2071 p->Invalidate();
2072 p->Validate();
2073 }
2074 break;
2075 }
2076 }
2077
2078 return 0;
2079 }
2080 break;
2081*/
2082 //====================
2083
2084 case BB_RECONFIGURE:
2085 case BB_REDRAWGUI:
2086 {
2087 if ((uMsg == BB_REDRAWGUI) && !(wParam & BBRG_MENU)) break;
2088
2089 // Block access to the menu...
2090 p->Invalidate();
2091
2092 // Set new menu item dimensions based on values calculated in MenuCommon...
2093 MENUITERATOR m;
2094 for (m = p->m_MenuItems.begin(); m != p->m_MenuItems.end(); m++)
2095 {
2096 if ((*m)->itemType == MENUITEM_HEADER) (*m)->SetHeight(pMenuCommon->m_nTitleHeight);
2097 else if ((*m)->itemType == MENUITEM_SEPARATOR) (*m)->SetHeight(pMenuCommon->m_nSeparatorHeight);
2098 else if ((*m)->itemType == MENUITEM_MARGINPAD) (*m)->SetHeight(pMenuCommon->m_nMarginHeight);
2099 else if ((*m)->itemType == MENUITEM_FOOTER) (*m)->SetHeight(pMenuCommon->m_nGripHeight);
2100 else (*m)->SetHeight(pMenuCommon->m_nSubmenuHeight);
2101 }
2102
2103 // Recalculate the menu dimensions...
2104 p->Validate();
2105 // ...and update the menu window if its currently visible...
2106 if (IsWindowVisible(p->hMenuWnd)) p->UpdateMenuWindow();
2107 }
2108 break;
2109
2110 //====================
2111
2112 case BB_MENU:
2113 {
2114 Menu* pMenu = NULL;
2115
2116 if (wParam == 0) // Main menu
2117 {
2118 WIN32_FIND_DATA oldData = p->data;
2119 HANDLE hFind = FindFirstFile(pSettings->menuFile, &p->data);
2120 FindClose(hFind);
2121 if (CompareFileTime(&p->data.ftLastWriteTime, &oldData.ftLastWriteTime) == 1)
2122 {
2123 pMenuCommon->Hide();
2124 pMenuCommon->UpdateMainMenu(false);
2125 }
2126
2127 pMenu = pMenuCommon->m_pMainMenu;
2128 }
2129 else if (wParam == 1) // Workspaces menu
2130 {
2131 pMenu = pMenuCommon->m_pWorkspacesMenu;
2132 }
2133 else if (wParam == 2 || wParam == 3 || wParam == 4) // Configuration menu (nb. previously used for the legacy Toolbar/Systembar/Dock menus, now replaced with the common Configuration menu)
2134 {
2135 pMenu = pMenuCommon->m_pConfigMenu;
2136 }
2137 else if (wParam == 5) // Styles menu
2138 {
2139 pMenu = pMenuCommon->m_pStylesMenu;
2140 }
2141 else if (wParam == 6) // Themes menu
2142 {
2143 pMenu = pMenuCommon->m_pThemesMenu;
2144 }
2145
2146 if (pMenu != NULL)
2147 {
2148 pMenuCommon->Hide();
2149 pMenu->Show();
2150 }
2151 }
2152 break;
2153
2154 //====================
2155
2156 case BB_HIDEMENU:
2157 {
2158 pMenuCommon->Hide();
2159// p->Hide(HIDE_PARENTS);
2160// p->Hide(HIDE_CHILDREN);
2161 }
2162 break;
2163
2164 //====================
2165
2166 case WM_CTLCOLOREDIT: // -> Used by StringItem editor popup dialog windows
2167 {
2168 // SetTextColor((HDC)wParam, pSettings->MenuFrame->TextColor);
2169 // SetBkColor((HDC)wParam, pSettings->MenuFrame->Color);
2170 SetTextColor((HDC)wParam, 0x000000);
2171 SetBkColor((HDC)wParam, 0xffffff);
2172 return (LRESULT)GetStockObject(NULL_BRUSH);
2173 }
2174 break;
2175
2176 //====================
2177
2178 default:
2179 {
2180 ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
2181 }
2182
2183 //====================
2184 }
2185
2186 return ret;
2187}
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
Menu * pMenu
Definition Blackbox.cpp:40
Settings * pSettings
Definition Blackbox.cpp:46
#define BB_HIDEMENU
Definition BBApi.h:161
#define BB_REDRAWGUI
Definition BBApi.h:220
#define BB_MENU
Definition BBApi.h:160
#define BB_RECONFIGURE
Definition BBApi.h:147
#define BBRG_MENU
Definition BBApi.h:222
PreviewItem * pPreviewItem
Definition Blackbox.cpp:45
vector< Menu * > g_Menues
Definition Menu.cpp:47
#define GET_Y_LPARAM(lp)
Definition Menu.h:60
#define HIDE_THIS
Definition Menu.h:40
#define GET_X_LPARAM(lp)
Definition Menu.h:56
vector< MenuItem * >::iterator MENUITERATOR
Definition Menu.h:53
#define MENU_TRACK_MOUSE_TIMER
Definition Menu.h:49
#define MENUITEM_EDITINT
Definition MenuItem.h:44
#define MENUITEM_COMMAND
Definition MenuItem.h:42
#define MENUITEM_HEADER
Definition MenuItem.h:38
#define MENUITEM_MARGINPAD
Definition MenuItem.h:39
#define MENUITEM_SEPARATOR
Definition MenuItem.h:47
#define MENUITEM_FOOTER
Definition MenuItem.h:40
#define MENUITEM_FOLDER
Definition MenuItem.h:48
#define MENUITEM_BOOLEAN
Definition MenuItem.h:45
#define MENUITEM_EDITSTRING
Definition MenuItem.h:43
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_MENU_NAVIGATE
Definition Sounds.h:43
Definition FolderItem.h:44
void ShowSubMenu()
Definition FolderItem.cpp:119
Definition Menu.h:66
bool isValidated
Definition Menu.h:151
int menuX
Definition Menu.h:176
bool keyboardNavigationInProgress
Definition Menu.h:154
void UpdateMenuWindow()
Definition Menu.cpp:181
virtual bool OnUser(int nMessage, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
Definition Menu.cpp:1268
void Activate(int fActive, HWND hWnd)
Definition Menu.cpp:1114
Menu * GetParent()
Definition Menu.cpp:1201
HWND GetWindow()
Definition Menu.cpp:1183
void Validate()
Definition Menu.cpp:1325
void MouseLeave()
Definition Menu.cpp:1040
void Invalidate()
Definition Menu.cpp:1318
Menu * m_pParent
Definition Menu.h:145
void Mouse(UINT nMsg, int x, int y)
Definition Menu.cpp:897
vector< MenuItem * > m_MenuItems
Definition Menu.h:146
void Timer(int nTimer)
Definition Menu.cpp:1134
LRESULT Command(WPARAM wParam, LPARAM lParam)
Definition Menu.cpp:1285
int menuY
Definition Menu.h:176
void TogglePinned()
Definition Menu.cpp:1463
HWND hMenuWnd
Definition Menu.h:143
int menuHeight
Definition Menu.h:177
void Moving()
Definition Menu.cpp:1247
WIN32_FIND_DATA data
Definition Menu.h:139

Variable Documentation

◆ szMenuName

const char szMenuName[] = "BBMenu"

◆ pBImage

BImage* pBImage
extern

◆ pSettings

Settings* pSettings
extern

◆ pMenuCommon

MenuCommon* pMenuCommon
extern

◆ pPreviewItem

PreviewItem* pPreviewItem
extern

◆ g_Menues

vector<Menu*> g_Menues

◆ menuMessageSubscription

int menuMessageSubscription[] = { BB_RECONFIGURE, BB_REDRAWGUI, 0 }