mirror of https://github.com/buggins/dlangui.git
update styles
This commit is contained in:
parent
9bcff67702
commit
27e4b4e9cb
|
@ -302,15 +302,14 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style id="TREE_ITEM"
|
<style id="TREE_ITEM"
|
||||||
padding="2,2,2,2"
|
padding="1,1,1,1"
|
||||||
margins="0,0,0,0"
|
|
||||||
minWidth="100"
|
minWidth="100"
|
||||||
minHeight="16"
|
minHeight="16"
|
||||||
layoutWidth="FILL_PARENT"
|
layoutWidth="FILL_PARENT"
|
||||||
layoutHeight="WRAP_CONTENT"
|
layoutHeight="WRAP_CONTENT"
|
||||||
fontFace="Arial"
|
fontFace="Arial"
|
||||||
fontFamily="SansSerif"
|
fontFamily="SansSerif"
|
||||||
fontSize="16">
|
fontSize="12">
|
||||||
</style>
|
</style>
|
||||||
<style id="TREE_ITEM_EXPAND_ICON"
|
<style id="TREE_ITEM_EXPAND_ICON"
|
||||||
margins="2,0,2,0"
|
margins="2,0,2,0"
|
||||||
|
@ -333,6 +332,7 @@
|
||||||
layoutHeight="WRAP_CONTENT"
|
layoutHeight="WRAP_CONTENT"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
|
fontSize="12"
|
||||||
/>
|
/>
|
||||||
<style id="RESIZER_VERTICAL"
|
<style id="RESIZER_VERTICAL"
|
||||||
layoutWidth="FILL_PARENT"
|
layoutWidth="FILL_PARENT"
|
||||||
|
|
|
@ -98,10 +98,10 @@ class DockHost : WidgetGroupDefaultDrawing {
|
||||||
DockWindow[] left = getDockedWindowList(DockAlignment.Left);
|
DockWindow[] left = getDockedWindowList(DockAlignment.Left);
|
||||||
DockWindow[] right = getDockedWindowList(DockAlignment.Right);
|
DockWindow[] right = getDockedWindowList(DockAlignment.Right);
|
||||||
DockWindow[] bottom = getDockedWindowList(DockAlignment.Bottom);
|
DockWindow[] bottom = getDockedWindowList(DockAlignment.Bottom);
|
||||||
_topSpace = top.length ? rc.height / 5 : 0;
|
_topSpace = top.length ? rc.height / 4 : 0;
|
||||||
_bottomSpace = bottom.length ? rc.height / 5 : 0;
|
_bottomSpace = bottom.length ? rc.height / 4 : 0;
|
||||||
_rightSpace = right.length ? rc.width / 5 : 0;
|
_rightSpace = right.length ? rc.width / 4 : 0;
|
||||||
_leftSpace = left.length ? rc.width / 5 : 0;
|
_leftSpace = left.length ? rc.width / 4 : 0;
|
||||||
if (_bodyWidget)
|
if (_bodyWidget)
|
||||||
_bodyWidget.layout(Rect(rc.left + _leftSpace, rc.top + _topSpace, rc.right - _rightSpace, rc.bottom - _bottomSpace));
|
_bodyWidget.layout(Rect(rc.left + _leftSpace, rc.top + _topSpace, rc.right - _rightSpace, rc.bottom - _bottomSpace));
|
||||||
layoutDocked(top, Rect(rc.left + _leftSpace, rc.top, rc.right - _rightSpace, rc.top + _topSpace), Orientation.Horizontal);
|
layoutDocked(top, Rect(rc.left + _leftSpace, rc.top, rc.right - _rightSpace, rc.top + _topSpace), Orientation.Horizontal);
|
||||||
|
@ -143,6 +143,7 @@ class DockHost : WidgetGroupDefaultDrawing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// dock alignment types
|
||||||
enum DockAlignment {
|
enum DockAlignment {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
|
@ -177,11 +178,13 @@ class DockWindow : VerticalLayout {
|
||||||
protected HorizontalLayout _captionLayout;
|
protected HorizontalLayout _captionLayout;
|
||||||
protected TextWidget _caption;
|
protected TextWidget _caption;
|
||||||
protected ImageButton _closeButton;
|
protected ImageButton _closeButton;
|
||||||
|
|
||||||
this(string ID) {
|
this(string ID) {
|
||||||
super(ID);
|
super(ID);
|
||||||
_dockAlignment = DockAlignment.Right;
|
_dockAlignment = DockAlignment.Right; // default alignment is right
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool onCloseButtonClick(Widget source) {
|
protected bool onCloseButtonClick(Widget source) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ EditLine - single line editor.
|
||||||
|
|
||||||
EditBox - multiline editor
|
EditBox - multiline editor
|
||||||
|
|
||||||
|
LogWidget - readonly text box for showing logs
|
||||||
|
|
||||||
Synopsis:
|
Synopsis:
|
||||||
|
|
||||||
|
@ -530,6 +531,14 @@ class EditableContent {
|
||||||
return cast(dstring)buf;
|
return cast(dstring)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// append one or more lines at end
|
||||||
|
void appendLines(dstring[] lines...) {
|
||||||
|
TextRange rangeBefore;
|
||||||
|
rangeBefore.start = rangeBefore.end = lineEnd(_lines.length ? _lines.length - 1 : 0);
|
||||||
|
EditOperation op = new EditOperation(EditAction.Replace, rangeBefore, lines);
|
||||||
|
performOperation(op, this);
|
||||||
|
}
|
||||||
|
|
||||||
/// call listener to say that whole content is replaced e.g. by loading from file
|
/// call listener to say that whole content is replaced e.g. by loading from file
|
||||||
void notifyContentReplaced() {
|
void notifyContentReplaced() {
|
||||||
TextRange rangeBefore;
|
TextRange rangeBefore;
|
||||||
|
@ -2863,3 +2872,44 @@ class EditBox : EditWidgetBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Read only edit box for displaying logs with lines append operation
|
||||||
|
class LogWidget : EditBox {
|
||||||
|
|
||||||
|
protected int _maxLines;
|
||||||
|
/// max lines to show (when appended more than max lines, older lines will be truncated), 0 means no limit
|
||||||
|
@property int maxLines() { return _maxLines; }
|
||||||
|
/// set max lines to show (when appended more than max lines, older lines will be truncated), 0 means no limit
|
||||||
|
@property void maxLines(int n) { _maxLines = n; }
|
||||||
|
|
||||||
|
protected bool _scrollLock;
|
||||||
|
/// when true, automatically scrolls down when new lines are appended (usually being reset by scrollbar interaction)
|
||||||
|
@property bool scrollLock() { return _scrollLock; }
|
||||||
|
/// when true, automatically scrolls down when new lines are appended (usually being reset by scrollbar interaction)
|
||||||
|
@property void scrollLock(bool flg) { _scrollLock = flg; }
|
||||||
|
|
||||||
|
this(string ID) {
|
||||||
|
super(ID);
|
||||||
|
_scrollLock = true;
|
||||||
|
enabled = false;
|
||||||
|
fontSize = 12;
|
||||||
|
fontFace = "Consolas,Lucida Console,Courier New";
|
||||||
|
fontFamily = FontFamily.MonoSpace;
|
||||||
|
}
|
||||||
|
/// append lines to the end of text
|
||||||
|
void appendLines(dstring[] lines...) {
|
||||||
|
lines ~= ""d; // append new line after last line
|
||||||
|
content.appendLines(lines);
|
||||||
|
if (_maxLines > 0 && lineCount > _maxLines) {
|
||||||
|
TextRange range;
|
||||||
|
range.end.line = lineCount - _maxLines;
|
||||||
|
EditOperation op = new EditOperation(EditAction.Replace, range, [""d]);
|
||||||
|
_content.performOperation(op, this);
|
||||||
|
}
|
||||||
|
updateScrollBars();
|
||||||
|
if (_scrollLock) {
|
||||||
|
_caretPos = TextPosition(lineCount > 0 ? lineCount - 1 : 0, 0);
|
||||||
|
ensureCaretVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -27,8 +27,7 @@ class SourceEdit : EditBox {
|
||||||
super(ID);
|
super(ID);
|
||||||
fontFace = "Consolas,Lucida Console,Courier New";
|
fontFace = "Consolas,Lucida Console,Courier New";
|
||||||
fontFamily = FontFamily.MonoSpace;
|
fontFamily = FontFamily.MonoSpace;
|
||||||
fontSize = 14;
|
fontSize = 12;
|
||||||
fontWeight = 300;
|
|
||||||
layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
||||||
minFontSize(10).maxFontSize(75); // allow font zoom with Ctrl + MouseWheel
|
minFontSize(10).maxFontSize(75); // allow font zoom with Ctrl + MouseWheel
|
||||||
_showLineNumbers = true;
|
_showLineNumbers = true;
|
||||||
|
|
Loading…
Reference in New Issue