Ticket #8217: EditTextWidget_long.diff
File EditTextWidget_long.diff, 1.8 KB (added by , 22 years ago) |
---|
-
newgui.h
old new 135 135 void drawChar(byte c, int x, int y, NewGuiColor color); 136 136 int getStringWidth(const String &str); 137 137 int getCharWidth(byte c); 138 void drawString(const String &str, int x, int y, int w, NewGuiColor color, int align = kTextAlignLeft );138 void drawString(const String &str, int x, int y, int w, NewGuiColor color, int align = kTextAlignLeft, int deltax = 0); 139 139 140 140 void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch); 141 141 void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch); -
newgui.cpp
old new 429 429 return guifont[c+6]; 430 430 } 431 431 432 void NewGui::drawString(const String &str, int x, int y, int w, NewGuiColor color, int align ) {432 void NewGui::drawString(const String &str, int x, int y, int w, NewGuiColor color, int align, int deltax) { 433 433 const int leftX = x, rightX = x + w; 434 434 int width = getStringWidth(str); 435 435 if (align == kTextAlignCenter) 436 436 x = x + (w - width - 1)/2; 437 437 else if (align == kTextAlignRight) 438 438 x = x + w - width; 439 x += deltax; 439 440 440 441 for (int i = 0; i < str.size(); ++i) { 441 442 w = getCharWidth(str[i]); -
EditTextWidget.h
old new 34 34 bool _caretVisible; 35 35 uint32 _caretTime; 36 36 int _pos; 37 int _labelOffset; 37 38 public: 38 39 EditTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text); 39 40 … … 47 48 void drawWidget(bool hilite); 48 49 void drawCaret(bool erase); 49 50 void lostFocusWidget() { _backupString = _label; drawCaret(true); } 51 52 int getCaretPos(); 53 bool adjustOffset(); 50 54 }; 51 55 52 56 #endif