Explorar el Código

[Brl.Clipboard] Added documentation/samples

Ronny Otto hace 6 años
padre
commit
ac6d59a220

+ 15 - 0
clipboard.mod/doc/clearclipboard.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' empty the clipboard
+ClearClipboard(clipboard)
+
+print "content: ~q" + ClipboardText(clipboard) + "~q"
+
+'output:
+'content: ""

+ 19 - 0
clipboard.mod/doc/clipboardhasownership.bmx

@@ -0,0 +1,19 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:int = LCB_CLIPBOARD
+
+If ClipboardHasOwnerShip(clipboard, clipboardMode)
+	print "clipboard content created by us"
+Else
+	print "clipboard content of another application"
+EndIf

+ 15 - 0
clipboard.mod/doc/clipboardsettext.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' try to set a new text
+If ClipboardSetText(clipboard, "TEST") Then
+	Print ClipboardText(clipboard)
+EndIf
+
+'output:
+'TEST

+ 25 - 0
clipboard.mod/doc/clipboardsettextex.bmx

@@ -0,0 +1,25 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:Int = LCB_CLIPBOARD
+' variable to hold text length when fetching text with TextEx()
+Local textLength:Int
+
+' try to set a new text
+If ClipboardSetTextEx(clipboard, "TEST", clipboardMode) Then
+	Print ClipboardTextEx(clipboard, textLength, clipboardMode)
+	Print "length of clipboard content: " + textLength
+EndIf
+
+'output:
+'TEST
+'length of clipboard content: 4

+ 15 - 0
clipboard.mod/doc/clipboardtext.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' try to set a new text
+If ClipboardSetText(clipboard, "TEST") Then
+	Print ClipboardText(clipboard)
+EndIf
+
+'output:
+'TEST

+ 25 - 0
clipboard.mod/doc/clipboardtextex.bmx

@@ -0,0 +1,25 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:Int = LCB_CLIPBOARD
+' variable to hold text length when fetching text with TextEx()
+Local textLength:Int
+
+' try to set a new text
+If ClipboardSetTextEx(clipboard, "TEST", clipboardMode) Then
+	Print ClipboardTextEx(clipboard, textLength, clipboardMode)
+	Print "length of clipboard content: " + textLength
+EndIf
+
+'output:
+'TEST
+'length of clipboard content: 4

+ 15 - 0
clipboard.mod/doc/createclipboard.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = CreateClipboard()
+
+' print out currently hold text
+print "current: " + ClipboardText(clipboard)
+
+' try to set a new text
+If ClipboardSetText(clipboard, "TEST") Then
+	print "set: " + ClipboardText(clipboard)
+EndIf

+ 6 - 0
clipboard.mod/doc/intro.bbdoc

@@ -0,0 +1,6 @@
+A Brl.Clipboard allows to share (textual) data between applications.
+
+To create a clipboard manager, use the #CreateClipboard command.
+
+Set (textual) content of the clipboard using #ClipboardSetText or #ClipboardSetTextEx. Both commands return True or False depending on whether the text was set or not. You can also clear the clipboard  with #ClearClipboard command.
+To retrieve the (textual) content use #ClipboardSetText or #ClipboardSetTextEx.

+ 15 - 0
clipboard.mod/doc/tclipboard_clear.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = new TClipboard.Create()
+
+' empty the clipboard
+clipboard.Clear()
+
+print "content: ~q" + clipboard.Text() + "~q"
+
+'output:
+'content: ""

+ 15 - 0
clipboard.mod/doc/tclipboard_create.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = New TClipboard.Create()
+
+' print out currently hold text
+print "current: " + clipboard.Text()
+
+' try to set a new text
+If clipboard.SetText("TEST") Then
+	print "set: " + clipboard.Text()
+EndIf

+ 19 - 0
clipboard.mod/doc/tclipboard_hasownership.bmx

@@ -0,0 +1,19 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = new TClipboard.Create()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:int = LCB_CLIPBOARD
+
+If clipboard.HasOwnerShip(clipboardMode)
+	print "clipboard content created by us"
+Else
+	print "clipboard content of another application"
+EndIf

+ 15 - 0
clipboard.mod/doc/tclipboard_settext.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = New TClipboard.Create()
+
+' try to set a new text
+If clipboard.SetText("TEST") Then
+	Print clipboard.Text(clipboard)
+EndIf
+
+'output:
+'TEST

+ 25 - 0
clipboard.mod/doc/tclipboard_settextex.bmx

@@ -0,0 +1,25 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = New TClipboard.Create()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:Int = LCB_CLIPBOARD
+' variable to hold text length when fetching text with TextEx()
+Local textLength:Int
+
+' try to set a new text
+If clipboard.SetTextEx("TEST", clipboardMode) Then
+	Print clipboard.TextEx(textLength, clipboardMode)
+	Print "length of clipboard content: " + textLength
+EndIf
+
+'output:
+'TEST
+'length of clipboard content: 4

+ 15 - 0
clipboard.mod/doc/tclipboard_text.bmx

@@ -0,0 +1,15 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = New TClipboard.Create()
+
+' try to set a new text
+If clipboard.SetText("TEST") Then
+	Print clipboard.Text()
+EndIf
+
+'output:
+'TEST

+ 25 - 0
clipboard.mod/doc/tclipboard_textex.bmx

@@ -0,0 +1,25 @@
+SuperStrict
+
+Framework Brl.Clipboard
+Import Brl.StandardIO
+
+' create a clipboard manager to access the system wide clipboard
+Local clipboard:TClipboard = New TClipboard.Create()
+
+' clipboard mode can be:
+' LCB_CLIPBOARD = The primary (global) clipboard [default mode]
+' LCB_PRIMARY = The (global) mouse selection clipboard.
+' LCB_SECONDARY = The largely unused (global) secondary selection clipboard.
+Local clipboardMode:Int = LCB_CLIPBOARD
+' variable to hold text length when fetching text with TextEx()
+Local textLength:Int
+
+' try to set a new text
+If clipboard.SetTextEx("TEST", clipboardMode) Then
+	Print clipboard.TextEx(textLength, clipboardMode)
+	Print "length of clipboard content: " + textLength
+EndIf
+
+'output:
+'TEST
+'length of clipboard content: 4

+ 0 - 3
gnet.mod/doc/intro.bbdoc

@@ -1,6 +1,3 @@
-
-+GameNet
-
 The GameNet module (GNet for short) provides a set of commands for creating and managing multiplayer network 
 games.
 

+ 0 - 3
linkedlist.mod/doc/intro.bbdoc

@@ -1,6 +1,3 @@
-
-+Linked lists
-
 A linked list allows you to efficiently add and remove objects to and from a collection of objects.
 
 To create a linked list, use the #CreateList command.

+ 0 - 3
polledinput.mod/doc/intro.bbdoc

@@ -1,6 +1,3 @@
-
-+Polled input
-
 The polled input module provides an easy way to detect keyboard and mouse input.
 
 The functions in this module are only available when your program is running in #Graphics mode. When working on GUI applications, you should use #events instead.

+ 0 - 3
random.mod/doc/intro.bbdoc

@@ -1,6 +1,3 @@
-
-+Random numbers
-
 The random module contains commands for generating random numbers.
 
 The numbers generated are not really random, as without special hardware support a software algorithm cannot produce 'real' random numbers.

+ 0 - 3
reflection.mod/doc/intro.bbdoc

@@ -1,6 +1,3 @@
-
-+Reflection
-
 BlitzMax provides limited support for a form of runtime %reflection.
 
 Using reflection, programs can 'inspect' objects and types at runtime. You can determine the fields and methods contained in an object or type, set and get object fields and invoke - or 'call' - object methods.