Skip to content

Commit

Permalink
Scaling combo text according to zoom level
Browse files Browse the repository at this point in the history
Registering the comboDpiChange handler and applying change manually to
text, image and arrow and popup
  • Loading branch information
ShahzaibIbrahim committed Jun 26, 2024
1 parent 6133241 commit ce8ac1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2025,4 +2025,13 @@ public boolean traverse(int event){
}
return super.traverse(event);
}
/**
* @since 3.126
*/
public static void adapt(CCombo combo, Consumer<Widget> consumer) {
consumer.accept(combo.text);
consumer.accept(combo.list);
consumer.accept(combo.arrow);
consumer.accept(combo.popup);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* Contributors:
* Yatta Solutions - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.custom;
package org.eclipse.swt.internal;

import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.widgets.*;
Expand Down Expand Up @@ -52,9 +53,6 @@ private static void handleCComboDPIChange(Widget widget, int newZoom, float scal
}
CCombo combo = (CCombo) widget;

DPIZoomChangeRegistry.applyChange(combo.text, newZoom, scalingFactor);
DPIZoomChangeRegistry.applyChange(combo.list, newZoom, scalingFactor);
DPIZoomChangeRegistry.applyChange(combo.arrow, newZoom, scalingFactor);
DPIZoomChangeRegistry.applyChange(combo.popup, newZoom, scalingFactor);
CCombo.adapt(combo, w -> DPIZoomChangeRegistry.applyChange(w, newZoom, scalingFactor));
}
}

0 comments on commit ce8ac1a

Please sign in to comment.