]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Latex updates; added defines to printdlg.h for referring to generic print dialogs
[wxWidgets.git] / src / msw / textctrl.cpp
index 5fc6c3e2ad85657d256f6af2f035d6ae6c83e952..7ff7b7835692a3052dc53f34922e20b6b1b3ea03 100644 (file)
@@ -25,7 +25,7 @@
 #include "wx/settings.h"
 #endif
 
-#if USE_CLIPBOARD
+#if wxUSE_CLIPBOARD
 #include "wx/app.h"
 #include "wx/clipbrd.h"
 #endif
@@ -72,7 +72,7 @@ wxTextCtrl::wxTextCtrl(void)
  :streambuf()
 #endif
 {
-  fileName = "";
+  m_fileName = "";
   m_isRich = FALSE;
 }
 
@@ -83,7 +83,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-  fileName = "";
+  m_fileName = "";
   SetName(name);
   SetValidator(validator);
   if (parent) parent->AddChild(this);
@@ -321,7 +321,7 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
 
   wxGetCharSize(GetHWND(), &cx, &cy,GetFont());
 
-  float control_width, control_height, control_x, control_y;
+  int control_width, control_height, control_x, control_y;
 
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
@@ -333,17 +333,17 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (w1<=0)
     w1 = DEFAULT_ITEM_WIDTH;
 
-  control_x = (float)x1;
-  control_y = (float)y1;
-  control_width = (float)w1;
-  control_height = (float)h1;
+  control_x = x1;
+  control_y = y1;
+  control_width = w1;
+  control_height = h1;
 
   // Calculations may have made text size too small
   if (control_height <= 0)
-    control_height = (float)(int)(cy*EDIT_CONTROL_FACTOR) ;
+    control_height = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
 
   if (control_width <= 0)
-    control_width = (float)DEFAULT_ITEM_WIDTH;
+    control_width = DEFAULT_ITEM_WIDTH;
 
   MoveWindow((HWND) GetHWND(), (int)control_x, (int)control_y,
                               (int)control_width, (int)control_height, TRUE);
@@ -504,7 +504,7 @@ bool wxTextCtrl::LoadFile(const wxString& file)
   if (!FileExists(WXSTRINGCAST file))
     return FALSE;
 
-  fileName = file;
+  m_fileName = file;
 
   Clear();
 
@@ -553,14 +553,14 @@ bool wxTextCtrl::LoadFile(const wxString& file)
 // Returns TRUE if succeeds.
 bool wxTextCtrl::SaveFile(const wxString& file)
 {
-  wxString theFile;
-  if (file == "")
-    theFile = fileName;
-  if (file == "")
+  wxString theFile(file);
+  if (theFile == "")
+    theFile = m_fileName;
+  if (theFile == "")
     return FALSE;
-  fileName = theFile;
+  m_fileName = theFile;
 
-  ofstream output(WXSTRINGCAST file);
+  ofstream output((char*) (const char*) theFile);
   if (output.bad())
        return FALSE;
 
@@ -848,47 +848,46 @@ wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
 
 wxTextCtrl& wxTextCtrl::operator<<(float f)
 {
-  static char buf[100];
-  sprintf(buf, "%.2f", f);
-  WriteText(buf);
-  return *this;
+    wxString str;
+    str.Printf("%.2f", f);
+    WriteText(str);
+    return *this;
 }
 
 wxTextCtrl& wxTextCtrl::operator<<(double d)
 {
-  static char buf[100];
-  sprintf(buf, "%.2f", d);
-  WriteText(buf);
-  return *this;
+    wxString str;
+    str.Printf("%.2f", d);
+    WriteText(str);
+    return *this;
 }
 
 wxTextCtrl& wxTextCtrl::operator<<(int i)
 {
-  static char buf[100];
-  sprintf(buf, "%i", i);
-  WriteText(buf);
-  return *this;
+    wxString str;
+    str.Printf("%d", i);
+    WriteText(str);
+    return *this;
 }
 
 wxTextCtrl& wxTextCtrl::operator<<(long i)
 {
-  static char buf[100];
-  sprintf(buf, "%ld", i);
-  WriteText(buf);
-  return *this;
+    wxString str;
+    str.Printf("%ld", i);
+    WriteText(str);
+    return *this;
 }
 
 wxTextCtrl& wxTextCtrl::operator<<(const char c)
 {
-  char buf[2];
+    char buf[2];
 
-  buf[0] = c;
-  buf[1] = 0;
-  WriteText(buf);
-  return *this;
+    buf[0] = c;
+    buf[1] = 0;
+    WriteText(buf);
+    return *this;
 }
 
-
 WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
                        WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 {