| 1219 | } |
| 1220 | |
| 1221 | void CtrlrPopupMenuLook::drawPopupMenuItem (Graphics& g, |
| 1222 | int width, int height, |
| 1223 | const bool isSeparator, |
| 1224 | const bool isActive, |
| 1225 | const bool isHighlighted, |
| 1226 | const bool isTicked, |
| 1227 | const bool hasSubMenu, |
| 1228 | const String& text, |
| 1229 | const String& shortcutKeyText, |
| 1230 | Image* image, |
| 1231 | const Colour* const textColourToUse) |
| 1232 | { |
| 1233 | const float halfH = height * 0.5f; |
| 1234 | |
| 1235 | bool hasSecondLine = false; |
| 1236 | if (text.indexOf("\n") > 0) |
| 1237 | hasSecondLine = true; |
| 1238 | const int secondLineStart = Font(14).getStringWidth(text.upToFirstOccurrenceOf("\n",false, true)); |
| 1239 | const String secondLine = text.fromLastOccurrenceOf("\n", false, true); |
| 1240 | const String ttext = text.upToFirstOccurrenceOf("\n", false, true); |
| 1241 | |
| 1242 | if (isSeparator) |
| 1243 | { |
| 1244 | const float separatorIndent = 5.5f; |
| 1245 | |
| 1246 | g.setColour (Colour (0x33000000)); |
| 1247 | g.drawLine (separatorIndent, halfH, width - separatorIndent, halfH); |
| 1248 | |
| 1249 | g.setColour (Colour (0x66ffffff)); |
| 1250 | g.drawLine (separatorIndent, halfH + 1.0f, width - separatorIndent, halfH + 1.0f); |
| 1251 | } |
| 1252 | else |
| 1253 | { |
| 1254 | Colour textColour (Colours::black); |
| 1255 | |
| 1256 | if (textColourToUse != nullptr) |
| 1257 | textColour = *textColourToUse; |
| 1258 | |
| 1259 | if (isHighlighted) |
| 1260 | { |
| 1261 | g.setColour (Colour(0x991111aa)); |
| 1262 | g.fillRect (1, 1, width - 2, height - 2); |
| 1263 | |
| 1264 | g.setColour (Colours::white); |
| 1265 | } |
| 1266 | else |
| 1267 | { |
| 1268 | g.setColour (textColour); |
| 1269 | } |
| 1270 | |
| 1271 | if (! isActive) |
| 1272 | g.setOpacity (0.3f); |
| 1273 | |
| 1274 | Font font (14); |
| 1275 | |
| 1276 | if (font.getHeight() > height / 1.3f) |
| 1277 | font.setHeight (height / 1.3f); |
| 1278 |
nothing calls this directly
no test coverage detected