Project

General

Profile

Improvements #10586

Revise WPanel

Added by Roel Standaert 5 months ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
07/01/2022
Due date:
% Done:

0%

Estimated time:

Description

WPanel needs to be revised. It should conceptually be a rather simple widget, but seems a lot messier than it needs to be.

Exhibit 1:

  setJavaScriptMember
    (WT_RESIZE_JS,
     "function(self, w, h, s) {"
     """var hdefined = h >= 0;"
     """if (hdefined) {"
     ""  "var mh = " WT_CLASS ".px(self, 'maxHeight');"
     ""  "if (mh > 0) h = Math.min(h, mh);"
     """}"
     """if (" WT_CLASS ".boxSizing(self)) {"
     ""  "h -= " WT_CLASS ".px(self, 'borderTopWidth') + "
     ""       WT_CLASS ".px(self, 'borderBottomWidth');"
     """}"
     """var c = self.lastChild;"
     """var t = c.previousSibling;"
     """if (t)"
     ""  "h -= t.offsetHeight;"
     """h -= 8;" // padding
     """if (hdefined && h > 0) {"
     ""  "c.lh = true;"
     ""  "c.style.height = h + 'px';"
     // the panel is indirectly hidden: will this back-fire ?
     ""  "$(c).children().each(function() { "
     ""      "var self = $(this), "
     ""          "padding = self.outerHeight() - self.height();"
     ""      "self.height(h - padding);"
     ""      "this.lh = true;"
     ""  "});"
     """} else {"
     ""  "c.style.height = '';"
     ""  "c.lh = false;"
     ""  "$(c).children().each(function() { "
     ""    "this.style.height = '';"
     ""    "this.lh = false;"
     ""  "});"
     """}"
     "};");

The inline JavaScript at the very least needs to move to a separate JavaScript file, but modern CSS can likely make it obsolete.

For Bootstrap 5 we made collapsible panels use accordion instead of card, but we should probably reenable collapse/expand in C++ code, and make it use card as well for consistency.


Files

Customized_WPanel_Bootstrap3.png (3.4 KB) Customized_WPanel_Bootstrap3.png Roel Standaert, 07/01/2022 02:23 PM

Related issues

Related to Improvements #10395: WPanel::setTitleBar(false) should probably call WPanel::setCollapsible(false)ReviewKorneel Dumon05/20/2022

Actions
Related to Feature #10364: WBootstrap5Theme: re-add support for collapsible WPanel?ReviewKorneel Dumon05/16/2022

Actions
Related to Bug #9590: Panel header looses "panel-heading" class if titleBarWidget is created manuallyNew01/07/2022

Actions
#1

Updated by Roel Standaert 5 months ago

  • Related to Improvements #10395: WPanel::setTitleBar(false) should probably call WPanel::setCollapsible(false) added
#2

Updated by Roel Standaert 5 months ago

  • Related to Feature #10364: WBootstrap5Theme: re-add support for collapsible WPanel? added
#5

Updated by Roel Standaert 5 months ago

  • Related to Bug #9590: Panel header looses "panel-heading" class if titleBarWidget is created manually added

Also available in: Atom PDF