DOM types renamed.

This commit is contained in:
yglukhov 2015-04-06 14:36:36 +03:00
commit bf2abe2de2

View file

@ -38,8 +38,9 @@ type
addEventListener*: proc(ev: cstring, cb: proc(ev: ref TEvent), useCapture: bool = false) {.nimcall.} addEventListener*: proc(ev: cstring, cb: proc(ev: ref TEvent), useCapture: bool = false) {.nimcall.}
TWindow* {.importc.} = object of TEventHandlers Window* = ref WindowObj
document*: ref TDocument WindowObj {.importc.} = object of TEventHandlers
document*: Document
event*: ref TEvent event*: ref TEvent
history*: ref THistory history*: ref THistory
location*: ref TLocation location*: ref TLocation
@ -67,7 +68,7 @@ type
confirm*: proc (msg: cstring): bool {.nimcall.} confirm*: proc (msg: cstring): bool {.nimcall.}
disableExternalCapture*: proc () {.nimcall.} disableExternalCapture*: proc () {.nimcall.}
enableExternalCapture*: proc () {.nimcall.} enableExternalCapture*: proc () {.nimcall.}
find*: proc (text: cstring, caseSensitive = false, find*: proc (text: cstring, caseSensitive = false,
backwards = false) {.nimcall.} backwards = false) {.nimcall.}
focus*: proc () {.nimcall.} focus*: proc () {.nimcall.}
forward*: proc () {.nimcall.} forward*: proc () {.nimcall.}
@ -76,7 +77,7 @@ type
moveBy*: proc (x, y: int) {.nimcall.} moveBy*: proc (x, y: int) {.nimcall.}
moveTo*: proc (x, y: int) {.nimcall.} moveTo*: proc (x, y: int) {.nimcall.}
open*: proc (uri, windowname: cstring, open*: proc (uri, windowname: cstring,
properties: cstring = nil): ref TWindow {.nimcall.} properties: cstring = nil): Window {.nimcall.}
print*: proc () {.nimcall.} print*: proc () {.nimcall.}
prompt*: proc (text, default: cstring): cstring {.nimcall.} prompt*: proc (text, default: cstring): cstring {.nimcall.}
releaseEvents*: proc (eventMask: int) {.nimcall.} releaseEvents*: proc (eventMask: int) {.nimcall.}
@ -90,7 +91,8 @@ type
stop*: proc () {.nimcall.} stop*: proc () {.nimcall.}
frames*: seq[TFrame] frames*: seq[TFrame]
TFrame* {.importc.} = object of TWindow Frame* = ref FrameObj
FrameObj {.importc.} = object of WindowObj
ClassList* {.importc.} = object of RootObj ClassList* {.importc.} = object of RootObj
add*: proc (class: cstring) {.nimcall.} add*: proc (class: cstring) {.nimcall.}
@ -111,40 +113,43 @@ type
DocumentTypeNode, DocumentTypeNode,
DocumentFragmentNode, DocumentFragmentNode,
NotationNode NotationNode
TNode* {.importc.} = object of TEventHandlers
attributes*: seq[ref TNode] Node* = ref NodeObj
childNodes*: seq[ref TNode] NodeObj {.importc.} = object of TEventHandlers
children*: seq[ref TNode] attributes*: seq[Node]
childNodes*: seq[Node]
children*: seq[Node]
data*: cstring data*: cstring
firstChild*: ref TNode firstChild*: Node
lastChild*: ref TNode lastChild*: Node
nextSibling*: ref TNode nextSibling*: Node
nodeName*: cstring nodeName*: cstring
nodeType*: TNodeType nodeType*: TNodeType
nodeValue*: cstring nodeValue*: cstring
parentNode*: ref TNode parentNode*: Node
previousSibling*: ref TNode previousSibling*: Node
appendChild*: proc (child: ref TNode) {.nimcall.} appendChild*: proc (child: Node) {.nimcall.}
appendData*: proc (data: cstring) {.nimcall.} appendData*: proc (data: cstring) {.nimcall.}
cloneNode*: proc (copyContent: bool): ref TNode {.nimcall.} cloneNode*: proc (copyContent: bool): Node {.nimcall.}
deleteData*: proc (start, len: int) {.nimcall.} deleteData*: proc (start, len: int) {.nimcall.}
getAttribute*: proc (attr: cstring): cstring {.nimcall.} getAttribute*: proc (attr: cstring): cstring {.nimcall.}
getAttributeNode*: proc (attr: cstring): ref TNode {.nimcall.} getAttributeNode*: proc (attr: cstring): Node {.nimcall.}
hasChildNodes*: proc (): bool {.nimcall.} hasChildNodes*: proc (): bool {.nimcall.}
innerHTML*: cstring innerHTML*: cstring
insertBefore*: proc (newNode, before: ref TNode) {.nimcall.} insertBefore*: proc (newNode, before: Node) {.nimcall.}
insertData*: proc (position: int, data: cstring) {.nimcall.} insertData*: proc (position: int, data: cstring) {.nimcall.}
removeAttribute*: proc (attr: cstring) {.nimcall.} removeAttribute*: proc (attr: cstring) {.nimcall.}
removeAttributeNode*: proc (attr: ref TNode) {.nimcall.} removeAttributeNode*: proc (attr: Node) {.nimcall.}
removeChild*: proc (child: ref TNode) {.nimcall.} removeChild*: proc (child: Node) {.nimcall.}
replaceChild*: proc (newNode, oldNode: ref TNode) {.nimcall.} replaceChild*: proc (newNode, oldNode: Node) {.nimcall.}
replaceData*: proc (start, len: int, text: cstring) {.nimcall.} replaceData*: proc (start, len: int, text: cstring) {.nimcall.}
scrollIntoView*: proc () {.nimcall.} scrollIntoView*: proc () {.nimcall.}
setAttribute*: proc (name, value: cstring) {.nimcall.} setAttribute*: proc (name, value: cstring) {.nimcall.}
setAttributeNode*: proc (attr: ref TNode) {.nimcall.} setAttributeNode*: proc (attr: Node) {.nimcall.}
style*: ref TStyle style*: ref TStyle
TDocument* {.importc.} = object of TNode Document* = ref DocumentObj
DocumentObj {.importc.} = object of NodeObj
alinkColor*: cstring alinkColor*: cstring
bgColor*: cstring bgColor*: cstring
charset*: cstring charset*: cstring
@ -158,13 +163,13 @@ type
URL*: cstring URL*: cstring
vlinkColor*: cstring vlinkColor*: cstring
captureEvents*: proc (eventMask: int) {.nimcall.} captureEvents*: proc (eventMask: int) {.nimcall.}
createAttribute*: proc (identifier: cstring): ref TNode {.nimcall.} createAttribute*: proc (identifier: cstring): Node {.nimcall.}
createElement*: proc (identifier: cstring): ref TNode {.nimcall.} createElement*: proc (identifier: cstring): Element {.nimcall.}
createTextNode*: proc (identifier: cstring): ref TNode {.nimcall.} createTextNode*: proc (identifier: cstring): Node {.nimcall.}
getElementById*: proc (id: cstring): ref TElement {.nimcall.} getElementById*: proc (id: cstring): Element {.nimcall.}
getElementsByName*: proc (name: cstring): seq[ref TElement] {.nimcall.} getElementsByName*: proc (name: cstring): seq[Element] {.nimcall.}
getElementsByTagName*: proc (name: cstring): seq[ref TElement] {.nimcall.} getElementsByTagName*: proc (name: cstring): seq[Element] {.nimcall.}
getElementsByClassName*: proc (name: cstring): seq[ref TElement] {.nimcall.} getElementsByClassName*: proc (name: cstring): seq[Element] {.nimcall.}
getSelection*: proc (): cstring {.nimcall.} getSelection*: proc (): cstring {.nimcall.}
handleEvent*: proc (event: ref TEvent) {.nimcall.} handleEvent*: proc (event: ref TEvent) {.nimcall.}
open*: proc () {.nimcall.} open*: proc () {.nimcall.}
@ -172,20 +177,21 @@ type
routeEvent*: proc (event: ref TEvent) {.nimcall.} routeEvent*: proc (event: ref TEvent) {.nimcall.}
write*: proc (text: cstring) {.nimcall.} write*: proc (text: cstring) {.nimcall.}
writeln*: proc (text: cstring) {.nimcall.} writeln*: proc (text: cstring) {.nimcall.}
anchors*: seq[ref TAnchor] anchors*: seq[AnchorElement]
forms*: seq[ref TForm] forms*: seq[FormElement]
images*: seq[ref TImage] images*: seq[ImageElement]
applets*: seq[ref TApplet] applets*: seq[ref TApplet]
embeds*: seq[ref TEmbed] embeds*: seq[EmbedElement]
links*: seq[ref TLink] links*: seq[LinkElement]
TElement* {.importc.} = object of TNode Element* = ref ElementObj
ElementObj {.importc.} = object of NodeObj
classList*: ref Classlist classList*: ref Classlist
checked*: bool checked*: bool
defaultChecked*: bool defaultChecked*: bool
defaultValue*: cstring defaultValue*: cstring
disabled*: bool disabled*: bool
form*: ref TForm form*: FormElement
name*: cstring name*: cstring
readOnly*: bool readOnly*: bool
blur*: proc () {.nimcall.} blur*: proc () {.nimcall.}
@ -193,17 +199,19 @@ type
focus*: proc () {.nimcall.} focus*: proc () {.nimcall.}
handleEvent*: proc (event: ref TEvent) {.nimcall.} handleEvent*: proc (event: ref TEvent) {.nimcall.}
select*: proc () {.nimcall.} select*: proc () {.nimcall.}
options*: seq[ref TOption] options*: seq[OptionElement]
getElementsByTagName*: proc (name: cstring): seq[ref TNode] {.nimcall.} getElementsByTagName*: proc (name: cstring): seq[Element] {.nimcall.}
getElementsByClassName*: proc (name: cstring): seq[ref TNode] {.nimcall.} getElementsByClassName*: proc (name: cstring): seq[Element] {.nimcall.}
TLink* {.importc.} = object of TElement LinkElement* = ref LinkObj
LinkObj {.importc.} = object of ElementObj
target*: cstring target*: cstring
text*: cstring text*: cstring
x*: int x*: int
y*: int y*: int
TEmbed* {.importc.} = object of TElement EmbedElement* = ref EmbedObj
EmbedObj {.importc.} = object of ElementObj
height*: int height*: int
hspace*: int hspace*: int
src*: cstring src*: cstring
@ -213,30 +221,33 @@ type
play*: proc () {.nimcall.} play*: proc () {.nimcall.}
stop*: proc () {.nimcall.} stop*: proc () {.nimcall.}
TAnchor* {.importc.} = object of RootObj AnchorElement* = ref AnchorObj
name*: cstring AnchorObj {.importc.} = object of ElementObj
text*: cstring text*: cstring
x*, y*: int x*, y*: int
TApplet* {.importc.} = object of RootObj TApplet* {.importc.} = object of RootObj
TOption* {.importc.} = object of TElement OptionElement* = ref OptionObj
OptionObj {.importc.} = object of ElementObj
defaultSelected*: bool defaultSelected*: bool
selected*: bool selected*: bool
selectedIndex*: int selectedIndex*: int
text*: cstring text*: cstring
value*: cstring value*: cstring
TForm* {.importc.} = object of TElement FormElement* = ref FormObj
FormObj {.importc.} = object of ElementObj
action*: cstring action*: cstring
encoding*: cstring encoding*: cstring
`method`*: cstring `method`*: cstring
target*: cstring target*: cstring
reset*: proc () {.nimcall.} reset*: proc () {.nimcall.}
submit*: proc () {.nimcall.} submit*: proc () {.nimcall.}
elements*: seq[ref TElement] elements*: seq[Element]
TImage* {.importc.} = object of TElement ImageElement* = ref ImageObj
ImageObj {.importc.} = object of ElementObj
border*: int border*: int
complete*: bool complete*: bool
height*: int height*: int
@ -342,7 +353,7 @@ type
setAttribute*: proc (attr, value: cstring, caseSensitive=false) {.nimcall.} setAttribute*: proc (attr, value: cstring, caseSensitive=false) {.nimcall.}
TEvent* {.importc.} = object of RootObj TEvent* {.importc.} = object of RootObj
target*: ref TNode target*: Node
altKey*, ctrlKey*, shiftKey*: bool altKey*, ctrlKey*, shiftKey*: bool
button*: int button*: int
clientX*, clientY*: int clientX*, clientY*: int
@ -440,8 +451,8 @@ type
TInterval* {.importc.} = object of RootObj TInterval* {.importc.} = object of RootObj
var var
window* {.importc, nodecl.}: ref TWindow window* {.importc, nodecl.}: Window
document* {.importc, nodecl.}: ref TDocument document* {.importc, nodecl.}: Document
navigator* {.importc, nodecl.}: ref TNavigator navigator* {.importc, nodecl.}: ref TNavigator
screen* {.importc, nodecl.}: ref TScreen screen* {.importc, nodecl.}: ref TScreen
@ -458,3 +469,17 @@ proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.}
proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.} proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.}
proc parseInt*(s: cstring): int {.importc, nodecl.} proc parseInt*(s: cstring): int {.importc, nodecl.}
proc parseInt*(s: cstring, radix: int):int {.importc, nodecl.} proc parseInt*(s: cstring, radix: int):int {.importc, nodecl.}
type
TWindow* {.deprecated.} = WindowObj
TFrame* {.deprecated.} = FrameObj
TNode* {.deprecated.} = NodeObj
TDocument* {.deprecated.} = DocumentObj
TElement* {.deprecated.} = ElementObj
TLink* {.deprecated.} = LinkObj
TEmbed* {.deprecated.} = EmbedObj
TAnchor* {.deprecated.} = AnchorObj
TOption* {.deprecated.} = OptionObj
TForm* {.deprecated.} = FormObj
TImage* {.deprecated.} = ImageObj