PluginSupport.st
changeset 9045 62fb1014a790
parent 9044 1250af6a24e5
child 9046 c31812178624
equal deleted inserted replaced
9044:1250af6a24e5 9045:62fb1014a790
     1 "
     1 "
     2  COPYRIGHT (c) 2005 by Claus Gittinger
     2  COPYRIGHT (c) 2005 by Claus Gittinger
     3               All Rights Reserved
     3 	      All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    22 !PluginSupport class methodsFor:'documentation'!
    22 !PluginSupport class methodsFor:'documentation'!
    23 
    23 
    24 copyright
    24 copyright
    25 "
    25 "
    26  COPYRIGHT (c) 2005 by Claus Gittinger
    26  COPYRIGHT (c) 2005 by Claus Gittinger
    27               All Rights Reserved
    27 	      All Rights Reserved
    28 
    28 
    29  This software is furnished under a license and may be used
    29  This software is furnished under a license and may be used
    30  only in accordance with the terms of that license and with the
    30  only in accordance with the terms of that license and with the
    31  inclusion of the above copyright notice.   This software may not
    31  inclusion of the above copyright notice.   This software may not
    32  be provided or otherwise made available to, or used by, any
    32  be provided or otherwise made available to, or used by, any
    39 "
    39 "
    40     Provides support functions to run stx in a browser window as a plugin.
    40     Provides support functions to run stx in a browser window as a plugin.
    41     (actually, it could be started from any other application just the same...)
    41     (actually, it could be started from any other application just the same...)
    42 
    42 
    43     [author:]
    43     [author:]
    44         Claus Gittinger
    44 	Claus Gittinger
    45 
    45 
    46     [see also:]
    46     [see also:]
    47         Smalltalk
    47 	Smalltalk
    48 "
    48 "
       
    49 ! !
       
    50 
       
    51 !PluginSupport class methodsFor:'support'!
       
    52 
       
    53 setPluginWindowHandle:windowId
       
    54 %{
       
    55     extern void __pluginSetWindow();
       
    56 #   define HWND         void *
       
    57 #   define _HWNDVal(o)  (HWND)(__MKCP(o))
       
    58 
       
    59     if (__isExternalAddress(windowId)) {
       
    60 	HWND hWnd = _HWNDVal(windowId);
       
    61 	__pluginSetWindow(hWnd);
       
    62     }
       
    63 %}.
    49 ! !
    64 ! !
    50 
    65 
    51 !PluginSupport class methodsFor:'startup'!
    66 !PluginSupport class methodsFor:'startup'!
    52 
    67 
    53 start:anApplicationClass inWindowWithID:windowID parameters:parameters
    68 start:anApplicationClass inWindowWithID:windowID parameters:parameters
    56     browserWindow := ExternalTopView newWithID:windowID.
    71     browserWindow := ExternalTopView newWithID:windowID.
    57     browserWindow viewBackground:(Color red).
    72     browserWindow viewBackground:(Color red).
    58     browserWindow clear.
    73     browserWindow clear.
    59 
    74 
    60     (anApplicationClass isSubclassOf:ApplicationModel) ifTrue:[
    75     (anApplicationClass isSubclassOf:ApplicationModel) ifTrue:[
    61         app := anApplicationClass new.
    76 	app := anApplicationClass new.
    62         app allButOpen.
    77 	app allButOpen.
    63         browserWindow becomeParentOf:app window.
    78 	browserWindow becomeParentOf:app window.
    64         app window extent:1.0@1.0.
    79 	"/ app window extent:1.0@1.0.
       
    80 	self setPluginWindowHandle:(app window id).
    65     ] ifFalse:[
    81     ] ifFalse:[
    66         v := anApplicationClass new.
    82 	v := anApplicationClass new.
    67         browserWindow becomeParentOf:v.
    83 	browserWindow becomeParentOf:v.
    68     ].
    84     ].
    69 
    85 
    70     "/ wait forEver
    86     "/ wait forEver
    71 "/    Semaphore new wait.
    87 "/    Semaphore new wait.
    72 !
    88 !
    73 
    89 
    74 startInBrowserWithWindowID:windowID parameters:parameters
    90 startInBrowserWithWindowID:windowID parameters:parameters
    75     self 
    91     self
    76         start:(WorkspaceApplication ? Workspace)
    92 	start:(WorkspaceApplication ? Workspace)
    77         inWindowWithID:windowID 
    93 	inWindowWithID:windowID
    78         parameters:parameters
    94 	parameters:parameters
    79 
    95 
    80     "
    96     "
    81      |v|
    97      |v|
    82 
    98 
    83      v := StandardSystemView new.
    99      v := StandardSystemView new.
    98 ! !
   114 ! !
    99 
   115 
   100 !PluginSupport class methodsFor:'documentation'!
   116 !PluginSupport class methodsFor:'documentation'!
   101 
   117 
   102 version
   118 version
   103     ^ '$Header: /cvs/stx/stx/libbasic/PluginSupport.st,v 1.6 2005-12-21 18:48:25 cg Exp $'
   119     ^ '$Header: /cvs/stx/stx/libbasic/PluginSupport.st,v 1.7 2005-12-21 19:52:45 cg Exp $'
   104 ! !
   120 ! !