-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement popup window alignment with respect to caret or selection.
Closes #36.
- Loading branch information
1 parent
96d7cee
commit ff8f222
Showing
5 changed files
with
146 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
richtextfx/src/main/java/org/fxmisc/richtext/PopupAlignment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.fxmisc.richtext; | ||
|
||
import static org.fxmisc.richtext.PopupAlignment.HorizontalAlignment.*; | ||
import static org.fxmisc.richtext.PopupAlignment.AnchorObject.*; | ||
import static org.fxmisc.richtext.PopupAlignment.VerticalAlignment.*; | ||
|
||
public enum PopupAlignment { | ||
CARET_TOP(CARET, TOP, H_CENTER), | ||
CARET_CENTER(CARET, V_CENTER, H_CENTER), | ||
CARET_BOTTOM(CARET, BOTTOM, H_CENTER), | ||
SELECTION_TOP_LEFT(SELECTION, TOP, LEFT), | ||
SELECTION_TOP_CENTER(SELECTION, TOP, H_CENTER), | ||
SELECTION_TOP_RIGHT(SELECTION, TOP, RIGHT), | ||
SELECTION_CENTER_LEFT(SELECTION, V_CENTER, LEFT), | ||
SELECTION_CENTER(SELECTION, V_CENTER, H_CENTER), | ||
SELECTION_CENTER_RIGHT(SELECTION, V_CENTER, RIGHT), | ||
SELECTION_BOTTOM_LEFT(SELECTION, BOTTOM, LEFT), | ||
SELECTION_BOTTOM_CENTER(SELECTION, BOTTOM, H_CENTER), | ||
SELECTION_BOTTOM_RIGHT(SELECTION, BOTTOM, RIGHT); | ||
|
||
public static enum AnchorObject { | ||
CARET, | ||
SELECTION, | ||
} | ||
|
||
public static enum VerticalAlignment { | ||
TOP, | ||
V_CENTER, | ||
BOTTOM, | ||
} | ||
|
||
public static enum HorizontalAlignment { | ||
LEFT, | ||
H_CENTER, | ||
RIGHT, | ||
} | ||
|
||
private AnchorObject anchor; | ||
private VerticalAlignment vAlign; | ||
private HorizontalAlignment hAlign; | ||
|
||
private PopupAlignment( | ||
AnchorObject anchor, | ||
VerticalAlignment vAlign, | ||
HorizontalAlignment hAlign) { | ||
this.anchor = anchor; | ||
this.vAlign = vAlign; | ||
this.hAlign = hAlign; | ||
} | ||
|
||
public AnchorObject getAnchorObject() { return anchor; } | ||
public VerticalAlignment getVerticalAlignment() { return vAlign; } | ||
public HorizontalAlignment getHorizontalAlignment() { return hAlign; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters