-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly require all components to have a screen reference. This allows them reliable access to various services at all times. Implement multi-line text views with selection. Implement scrollable text areas. Affects: #42 Affects: #14 Affects: #13
- Loading branch information
Showing
214 changed files
with
9,704 additions
and
2,344 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
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
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
73 changes: 73 additions & 0 deletions
73
....api/src/main/java/com/io7m/jsycamore/api/components/SyTextMultiLineViewReadableType.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,73 @@ | ||
/* | ||
* Copyright © 2021 Mark Raynsford <[email protected]> https://www.io7m.com | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*/ | ||
|
||
package com.io7m.jsycamore.api.components; | ||
|
||
import com.io7m.jattribute.core.AttributeReadableType; | ||
import com.io7m.jsycamore.api.layout.SyLayoutContextType; | ||
import com.io7m.jsycamore.api.text.SyTextLineMeasuredType; | ||
import com.io7m.jsycamore.api.themes.SyThemeClassNameType; | ||
|
||
import java.util.List; | ||
import java.util.SortedMap; | ||
|
||
import static com.io7m.jsycamore.api.themes.SyThemeClassNameStandard.TEXT_MULTILINE_VIEW; | ||
|
||
/** | ||
* Read-only access to multi-line text views. | ||
*/ | ||
|
||
public interface SyTextMultiLineViewReadableType | ||
extends SyComponentReadableType | ||
{ | ||
/** | ||
* @return An attribute indicating if this text view is selectable | ||
*/ | ||
|
||
AttributeReadableType<Boolean> textSelectable(); | ||
|
||
/** | ||
* @return {@code true} if {@link #textSelectable()} is {@code true} | ||
*/ | ||
|
||
default boolean isTextSelectable() | ||
{ | ||
return this.textSelectable().get().booleanValue(); | ||
} | ||
|
||
@Override | ||
default List<SyThemeClassNameType> themeClassesDefaultForComponent() | ||
{ | ||
return List.of(TEXT_MULTILINE_VIEW); | ||
} | ||
|
||
/** | ||
* @return A read-only snapshot of the texts by Y offset | ||
*/ | ||
|
||
SortedMap<Integer, SyTextLineMeasuredType> textsByYOffset(); | ||
|
||
/** | ||
* Determine the minimum size on the Y axis required to display the | ||
* contained text fully. | ||
* | ||
* @param layoutContext The layout context | ||
* | ||
* @return The minimum size on the Y axis | ||
*/ | ||
|
||
int minimumSizeYRequired(SyLayoutContextType layoutContext); | ||
} |
78 changes: 78 additions & 0 deletions
78
...sycamore.api/src/main/java/com/io7m/jsycamore/api/components/SyTextMultiLineViewType.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,78 @@ | ||
/* | ||
* Copyright © 2021 Mark Raynsford <[email protected]> https://www.io7m.com | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*/ | ||
|
||
package com.io7m.jsycamore.api.components; | ||
|
||
import com.io7m.jattribute.core.AttributeType; | ||
import com.io7m.jsycamore.api.text.SyText; | ||
import com.io7m.jsycamore.api.text.SyTextMultiLineModelType; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Write access to multi-line text views. | ||
*/ | ||
|
||
public interface SyTextMultiLineViewType | ||
extends SyTextMultiLineViewReadableType, SyComponentType | ||
{ | ||
/** | ||
* @return An attribute indicating if this text view is selectable | ||
*/ | ||
|
||
@Override | ||
AttributeType<Boolean> textSelectable(); | ||
|
||
/** | ||
* Set whether the text view is selectable. | ||
* | ||
* @param selectable {@code true} if the text view is selectable | ||
*/ | ||
|
||
default void setTextSelectable( | ||
final boolean selectable) | ||
{ | ||
this.textSelectable().set(Boolean.valueOf(selectable)); | ||
} | ||
|
||
/** | ||
* Append a section of text. | ||
* | ||
* @param section The text section | ||
* | ||
* @see SyTextMultiLineModelType#textSectionAppend(SyText) | ||
*/ | ||
|
||
default void textSectionAppend( | ||
final SyText section) | ||
{ | ||
this.textSectionsAppend( | ||
List.of(Objects.requireNonNull(section, "section")) | ||
); | ||
} | ||
|
||
/** | ||
* Append sections of text. | ||
* | ||
* @param sections The text sections | ||
* | ||
* @see SyTextMultiLineModelType#textSectionsAppend(List) | ||
*/ | ||
|
||
void textSectionsAppend( | ||
List<SyText> sections); | ||
} |
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
Oops, something went wrong.