@@ -1195,17 +1195,8 @@ void TextEditInput::layout(StbTexteditRow *row, int start) const {
1195
1195
1196
1196
void TextEditInput::layout (int w, int h) {
1197
1197
if (_resizable) {
1198
- if (_height == _charHeight) {
1199
- _x = (w - _width) / 2 ;
1200
- _y = h - (_charHeight * 2.5 );
1201
- } else if (_width == _charWidth * SIDE_BAR_WIDTH) {
1202
- int border = _charWidth * 2 ;
1203
- _height = h - (border * 2 );
1204
- _x = w - (_width + border);
1205
- } else {
1206
- _width = w - (_x + _xmargin);
1207
- _height = h - (_y + _ymargin);
1208
- }
1198
+ _width = w - (_x + _xmargin);
1199
+ _height = h - (_y + _ymargin);
1209
1200
}
1210
1201
}
1211
1202
@@ -1932,7 +1923,8 @@ TextEditHelpWidget::TextEditHelpWidget(TextEditInput *editor, int chW, int chH,
1932
1923
_mode(kNone ),
1933
1924
_editor(editor),
1934
1925
_openPackage(nullptr ),
1935
- _openKeyword(-1 ) {
1926
+ _openKeyword(-1 ),
1927
+ _layout(kPopup ) {
1936
1928
_theme = new EditTheme (HELP_FG, HELP_BG);
1937
1929
hide ();
1938
1930
if (overlay) {
@@ -2417,8 +2409,10 @@ void TextEditHelpWidget::showPopup(int cols, int rows) {
2417
2409
}
2418
2410
_x = (_editor->_width - _width) / 2 ;
2419
2411
if (rows == 1 ) {
2412
+ _layout = kLine ;
2420
2413
_y = _editor->_height - (_charHeight * 2.5 );
2421
2414
} else {
2415
+ _layout = kPopup ;
2422
2416
_y = (_editor->_height - _height) / 2 ;
2423
2417
}
2424
2418
_theme->contrast (_editor->getTheme ());
@@ -2433,6 +2427,7 @@ void TextEditHelpWidget::showSidebar() {
2433
2427
_x = _editor->_width - (_width + border);
2434
2428
_y = border;
2435
2429
_theme->contrast (_editor->getTheme ());
2430
+ _layout = kSidebar ;
2436
2431
calcMargin ();
2437
2432
show ();
2438
2433
}
@@ -2446,3 +2441,23 @@ void TextEditHelpWidget::draw(int x, int y, int w, int h, int chw) {
2446
2441
maFillRect (x + _width, y + shadowH, shadowW, _height);
2447
2442
maFillRect (x + shadowW, y + _height, _width, shadowH);
2448
2443
}
2444
+
2445
+ void TextEditHelpWidget::layout (int w, int h) {
2446
+ if (_resizable) {
2447
+ int border;
2448
+ switch (_layout) {
2449
+ case kLine :
2450
+ _x = (w - _width) / 2 ;
2451
+ _y = h - (_charHeight * 2.5 );
2452
+ break ;
2453
+ case kSidebar :
2454
+ border = _charWidth * 2 ;
2455
+ _height = h - (border * 2 );
2456
+ _x = w - (_width + border);
2457
+ break ;
2458
+ case kPopup :
2459
+ _width = w - (_x + _xmargin);
2460
+ _height = h - (_y + _ymargin);
2461
+ }
2462
+ }
2463
+ }
0 commit comments