90 lines
1.9 KiB
Smalltalk
90 lines
1.9 KiB
Smalltalk
Class {
|
|
#name : #LeMiniDocsImport,
|
|
#superclass : #BrButton,
|
|
#instVars : [
|
|
'contentExtent',
|
|
'database'
|
|
],
|
|
#category : #'MiniDocs-UI'
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> contentExtent [
|
|
^ contentExtent
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> contentExtent: aPoint [
|
|
self
|
|
assert: [ aPoint isNotNil ]
|
|
description: [ 'Extent must be non-nil' ].
|
|
contentExtent := aPoint
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> createDropdownExpandedHandleButton [
|
|
^ BrButton new
|
|
icon: BrGlamorousVectorIcons downwards;
|
|
label: self tooltip;
|
|
aptitude: BrGlamorousButtonWithIconAndLabelAptitude
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> createURLeditable [
|
|
| base editable |
|
|
base := BlElement new
|
|
background: (Color white);
|
|
size: 200 @ 30;
|
|
margin: (BlInsets all: 10);
|
|
yourself.
|
|
editable := BrEditableLabel new
|
|
aptitude: BrGlamorousEditableLabelAptitude new glamorousRegularFontAndSize;
|
|
text: 'Document link';
|
|
switchToEditor.
|
|
editable when: BrEditorAcceptWish do: [ :aWish |
|
|
self importDocumentFrom: aWish text asString.
|
|
].
|
|
base addChild: editable.
|
|
^ base
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> database [
|
|
^ database
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> database: aLeDatabase [
|
|
database := aLeDatabase
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> importDocumentFrom: aURL [
|
|
^ self database importDocumentFrom: aURL.
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> initialize [
|
|
super initialize.
|
|
|
|
self
|
|
icon: BrGlamorousVectorIcons downwards;
|
|
label: 'Add MiniDocs';
|
|
aptitude: BrGlamorousButtonWithIconAndLabelAptitude.
|
|
self addAptitude: (BrGlamorousWithDropdownAptitude
|
|
handle: [ self createDropdownExpandedHandleButton ]
|
|
content: [ self createURLeditable ]).
|
|
|
|
self aptitude - BrGlamorousButtonExteriorAptitude.
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> tooltip [
|
|
^ self label
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
LeMiniDocsImport >> tooltip: aString [
|
|
self label: aString
|
|
]
|