MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / SetColor

Method SetColor

source/script_menu.cpp:973–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

971
972
973void UserMenu::SetColor(ExprTokenType &aColor, bool aApplyToSubmenus)
974{
975 // AssignColor() takes care of deleting old brush, etc.
976 if (TokenIsPureNumeric(aColor)) // Integer or float; float is invalid, so just truncate it to integer.
977 AssignColor(rgb_to_bgr((COLORREF)TokenToInt64(aColor)), mColor, mBrush);
978 else
979 AssignColor(TokenToString(aColor), mColor, mBrush);
980 // To avoid complications, such as a submenu being detached from its parent and then its parent
981 // later being deleted (which causes the HBRUSH to get deleted too), give each submenu it's
982 // own HBRUSH handle by calling SetColor() for each:
983 if (aApplyToSubmenus)
984 for (UserMenuItem *mi = mFirstMenuItem; mi; mi = mi->mNextMenuItem)
985 if (mi->mSubmenu)
986 mi->mSubmenu->SetColor(aColor, aApplyToSubmenus);
987 if (mMenu)
988 {
989 ApplyColor(aApplyToSubmenus);
990 UPDATE_GUI_MENU_BARS(mMenuType, mMenu) // Verified as being necessary.
991 }
992}
993
994
995

Callers

nothing calls this directly

Calls 5

TokenIsPureNumericFunction · 0.85
AssignColorFunction · 0.85
rgb_to_bgrFunction · 0.85
TokenToInt64Function · 0.85
TokenToStringFunction · 0.85

Tested by

no test coverage detected