Browse Source

*** empty log message ***

Mark Mine 24 years ago
parent
commit
a7d876741c
3 changed files with 19 additions and 3 deletions
  1. 15 3
      direct/src/gui/DirectEntry.py
  2. 1 0
      direct/src/gui/DirectGui.py
  3. 3 0
      direct/src/gui/DirectGuiGlobals.py

+ 15 - 3
direct/src/gui/DirectEntry.py

@@ -28,6 +28,8 @@ class DirectEntry(DirectFrame):
             ('width',           10,               self.setup),
             ('numLines',        5,                self.setup),
             ('focus',           0,                self.setFocus),
+            ('cursorKeys',      0,                self.setCursorKeysActive),
+            ('backgroundFocus', 0,                self.setBackgroundFocus),
             # Text used for the PGEntry text node
             # NOTE: This overrides the DirectFrame text option
             ('initialText',     '',               INITOPT),
@@ -81,12 +83,15 @@ class DirectEntry(DirectFrame):
     def setup(self):
         self.node().setup(self['width'], self['numLines'])
 
-    def setFont(self):
-        self.onscreenText.setFont(self['font'])
-
     def setFocus(self):
         PGEntry.setFocus(self.guiItem, self['focus'])
 
+    def setCursorKeysActive(self):
+        PGEntry.setCursorKeysActive(self.guiItem, self['cursorKeys'])
+
+    def setBackgroundFocus(self):
+        PGEntry.setBackgroundFocus(self.guiItem, self['backgroundFocus'])
+
     def setRolloverSound(self):
         if base.wantSfx:
             rolloverSound = self['rolloverSound']
@@ -106,4 +111,11 @@ class DirectEntry(DirectFrame):
     def get(self):
         return self.guiItem.getText()
 
+    def setCursorPosition(self, pos):
+        if (pos < 0):
+            self.guiItem.setCursorPosition(len(self.get()) + pos)
+        else:
+            self.guiItem.setCursorPosition(pos)
+            
+
 

+ 1 - 0
direct/src/gui/DirectGui.py

@@ -4,6 +4,7 @@ from DirectGuiGlobals import *
 import __builtin__
 __builtin__.guiTop = aspect2d.attachNewNode(PGTop('DirectGuiTop'))
 guiTop.node().setMouseWatcher(base.mouseWatcherNode)
+base.mouseWatcherNode.addRegion(PGMouseWatcherBackground())
 
 # Set up default font
 PGItem.getTextNode().setFont(getDefaultFont())

+ 3 - 0
direct/src/gui/DirectGuiGlobals.py

@@ -51,6 +51,9 @@ B3RELEASE = PGButton.getReleasePrefix() + MouseButton.three().getName() + '-'
 # For DirectEntry widgets
 OVERFLOW = PGEntry.getOverflowPrefix()
 ACCEPT = PGEntry.getAcceptPrefix() + KeyboardButton.enter().getName() + '-'
+TYPE = PGEntry.getTypePrefix()
+ERASE = PGEntry.getErasePrefix()
+
 
 # For setting the sorting order of a widget's visible components
 IMAGE_SORT_INDEX = 10