Skip to content

Commit

Permalink
Make scroll-bar invisible for horizontal/vertical header
Browse files Browse the repository at this point in the history
GEF automatically adds the H_SCROLL/V_SCROLL styles when creating a new
FigureCanvas instance, leading to scroll-bars being shown in the headers
and thus obscuring the entries.

Set the visibility of the scroll-bars to never be shown, to get around
this problem. Note that those headers are scroll together with the main
viewer, the bars are therefore not needed.

Relates to:
#894
  • Loading branch information
ptziegler committed Sep 23, 2024
1 parent 25cb2a5 commit 2060275
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2023 Google, Inc.
* Copyright (c) 2011, 2024 Google, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -12,6 +12,7 @@

import org.eclipse.wb.internal.draw2d.IPreferredSizeProvider;

import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.RangeModel;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.swt.SWT;
Expand All @@ -35,22 +36,11 @@ public HeaderGraphicalViewer(Composite parent, boolean horizontal) {
}

public HeaderGraphicalViewer(Composite parent, int style, boolean horizontal) {
super(parent, checkStyles(style));
super(parent, style);
getControl().setScrollBarVisibility(FigureCanvas.NEVER);
m_horizontal = horizontal;
}

private static final int checkStyles(int styles) {
// ignore horizontal scroll style
if ((styles & SWT.H_SCROLL) != 0) {
styles |= ~SWT.H_SCROLL;
}
// ignore vertical scroll style
if ((styles & SWT.V_SCROLL) != 0) {
styles |= ~SWT.V_SCROLL;
}
return styles;
}

////////////////////////////////////////////////////////////////////////////
//
// Access
Expand Down

0 comments on commit 2060275

Please sign in to comment.