浏览代码

add setup_minimal

David Rose 18 年之前
父节点
当前提交
0a0c4ecf98
共有 2 个文件被更改,包括 22 次插入7 次删除
  1. 21 7
      panda/src/pgui/pgEntry.cxx
  2. 1 0
      panda/src/pgui/pgEntry.h

+ 21 - 7
panda/src/pgui/pgEntry.cxx

@@ -489,13 +489,7 @@ erase(const MouseWatcherParameter &param) {
 ////////////////////////////////////////////////////////////////////
 void PGEntry::
 setup(float width, int num_lines) {
-  set_text(string());
-  _cursor_position = 0;
-  set_max_chars(0);
-  set_max_width(width);
-  set_num_lines(num_lines);
-
-  _accept_enabled = true;
+  setup_minimal(width, num_lines);
 
   TextNode *text_node = get_text_def(S_focus);
   float line_height = text_node->get_line_height();
@@ -552,6 +546,26 @@ setup(float width, int num_lines) {
 
   style.set_color(0.6f, 0.6f, 0.6f, 1.0f);
   set_frame_style(S_inactive, style);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PGEntry::setup_minimal
+//       Access: Published
+//  Description: Sets up the entry without creating any frame or other
+//               decoration.
+////////////////////////////////////////////////////////////////////
+void PGEntry::
+setup_minimal(float width, int num_lines) {
+  set_text(string());
+  _cursor_position = 0;
+  set_max_chars(0);
+  set_max_width(width);
+  set_num_lines(num_lines);
+
+  _accept_enabled = true;
+
+  TextNode *text_node = get_text_def(S_focus);
+  float line_height = text_node->get_line_height();
 
   // Set up a default cursor: a vertical bar.
   clear_cursor_def();

+ 1 - 0
panda/src/pgui/pgEntry.h

@@ -74,6 +74,7 @@ PUBLISHED:
   };
 
   void setup(float width, int num_lines);
+  void setup_minimal(float width, int num_lines);
 
   INLINE void set_text(const string &text);
   INLINE string get_plain_text() const;