Skip to content

Commit

Permalink
Menu Background fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahzaibIbrahim committed Aug 30, 2024
1 parent edcd338 commit 3293a91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ public class OS extends C {
public static final int OBJ_PEN = 0x1;
public static final int OBM_CHECKBOXES = 0x7ff7;
public static final int ODS_SELECTED = 0x1;
public static final int ODS_NOACCEL = 0x0100;
public static final int ODS_INACTIVE = 0x80;
public static final int ODT_MENU = 0x1;
public static final int OIC_BANG = 0x7F03;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,13 +1140,17 @@ LRESULT wmDrawChild(long wParam, long lParam) {
int flags = SWT.DRAW_MNEMONIC | SWT.DRAW_DELIMITER;
boolean isInactive = ((struct.itemState & OS.ODS_INACTIVE) != 0);
boolean isSelected = ((struct.itemState & OS.ODS_SELECTED) != 0);
boolean isNoAccel = ((struct.itemState & OS.ODS_NOACCEL) != 0);
Rectangle bounds = this.getBounds();
gc.setForeground(isInactive ? display.getSystemColor(SWT.COLOR_GRAY) : display.getSystemColor(SWT.COLOR_WHITE));
gc.setBackground(isSelected ? display.getSystemColor(SWT.COLOR_DARK_GRAY) : parent.getBackground());
int xMargin = DPIUtil.scaleDown(x + LEFT_TEXT_MARGIN, zoom) + (this.image != null ? this.image.getBounds().width : 0);
int yMargin = DPIUtil.scaleDown(struct.top + MARGIN_HEIGHT, zoom);

if(isNoAccel) {
gc.fillRectangle(DPIUtil.scaleDown(x, zoom), DPIUtil.scaleDown(struct.top + MARGIN_HEIGHT, zoom), DPIUtil.scaleDown(bounds.width + (image != null ? image.getBounds().width : 0), zoom), DPIUtil.scaleDown(bounds.height, zoom));
}

gc.fillRectangle(DPIUtil.scaleDown(x, zoom), DPIUtil.scaleDown(struct.top + MARGIN_HEIGHT, zoom), DPIUtil.scaleDown(bounds.width + (image != null ? image.getBounds().width : 0), zoom), DPIUtil.scaleDown(bounds.height, zoom));
gc.drawText(this.text, xMargin, yMargin, flags);
}
if (image != null) {
Expand Down

0 comments on commit 3293a91

Please sign in to comment.