<commit_before>// Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
#include "listareaimpl.hh"
#include "sizegroup.hh"
#include "paintcontainers.hh"
#include "factory.hh"
#include "application.hh"

//#define IFDEBUG(...)      do { /*__VA_ARGS__*/ } while (0)
#define IFDEBUG(...)      __VA_ARGS__

namespace Rapicorn {

// == WidgetList ==
const PropertyList&
WidgetList::_property_list()
{
  static Property *properties[] = {
    MakeProperty (WidgetList, browse, _("Browse Mode"), _("Browse selection mode"), "rw"),
    MakeProperty (WidgetList, model,  _("Model URL"), _("Resource locator for 1D list model"), "rw:M1"),
  };
  static const PropertyList property_list (properties, ContainerImpl::_property_list());
  return property_list;
}

// == WidgetListRowImpl ==
class WidgetListRowImpl : public virtual SingleContainerImpl,
                          public virtual EventHandler,
                          public virtual FocusFrame::Client {
  FocusFrame     *focus_frame_;
  int             index_;
  WidgetListImpl* widget_list () const  { return dynamic_cast<WidgetListImpl*> (parent()); }
protected:
  virtual const PropertyList&
  _property_list ()
  {
    static Property *properties[] = {
      MakeProperty (WidgetListRowImpl, selected,  _("Selected"), _("Indicates wether this row is selected"), "rw"),
      MakeProperty (WidgetListRowImpl, row_index, _("Row Index"), _("Row number inside WidgetList"), "ro"),
    };
    static const PropertyList property_list (properties, SingleContainerImpl::_property_list());
    return property_list;
  }
  virtual bool
  handle_event (const Event &event)
  {
    WidgetListImpl *list = widget_list();
    return list && list->row_event (event, this, index_);
  }
  virtual bool
  can_focus () const
  {
    return focus_frame_ != NULL;
  }
  virtual bool
  register_focus_frame (FocusFrame &frame)
  {
    if (!focus_frame_)
      focus_frame_ = &frame;
    return focus_frame_ == &frame;
  }
  virtual void<commit_msg>UI: listarea: add WidgetListRow.row_kind classification to test dumps<commit_after>// Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
#include "listareaimpl.hh"
#include "sizegroup.hh"
#include "paintcontainers.hh"
#include "factory.hh"
#include "application.hh"

//#define IFDEBUG(...)      do { /*__VA_ARGS__*/ } while (0)
#define IFDEBUG(...)      __VA_ARGS__

namespace Rapicorn {

// == WidgetList ==
const PropertyList&
WidgetList::_property_list()
{
  static Property *properties[] = {
    MakeProperty (WidgetList, browse, _("Browse Mode"), _("Browse selection mode"), "rw"),
    MakeProperty (WidgetList, model,  _("Model URL"), _("Resource locator for 1D list model"), "rw:M1"),
  };
  static const PropertyList property_list (properties, ContainerImpl::_property_list());
  return property_list;
}

// == WidgetListRowImpl ==
class WidgetListRowImpl : public virtual SingleContainerImpl,
                          public virtual EventHandler,
                          public virtual FocusFrame::Client {
  FocusFrame     *focus_frame_;
  int             index_;
  WidgetListImpl* widget_list () const  { return dynamic_cast<WidgetListImpl*> (parent()); }
protected:
  virtual const PropertyList&
  _property_list ()
  {
    static Property *properties[] = {
      MakeProperty (WidgetListRowImpl, selected,  _("Selected"), _("Indicates wether this row is selected"), "rw"),
      MakeProperty (WidgetListRowImpl, row_index, _("Row Index"), _("Row number inside WidgetList"), "ro"),
    };
    static const PropertyList property_list (properties, SingleContainerImpl::_property_list());
    return property_list;
  }
  virtual void
  dump_private_data (TestStream &tstream)
  {
    WidgetListImpl *list = widget_list();
    int kind = 0;
    if (list && index_ >= 0)
      {
        ListRow *lr = list->row_map_[index_];
        if (lr && lr->lrow == this)
          kind = 1;
        else
          {
            lr = list->row_cache_[index_];
            if (lr && lr->lrow == this)
              kind = 2;
            else
              kind = 3;
          }
      }
    const char *knames[] = { "nil", "mapped", "cached", "dangling" };
    tstream.dump ("row_kind", String (knames[kind]));
  }
  virtual bool
  handle_event (const Event &event)
  {
    WidgetListImpl *list = widget_list();
    return list && list->row_event (event, this, index_);
  }
  virtual bool
  can_focus () const
  {
    return focus_frame_ != NULL;
  }
  virtual bool
  register_focus_frame (FocusFrame &frame)
  {
    if (!focus_frame_)
      focus_frame_ = &frame;
    return focus_frame_ == &frame;
  }
  virtual void
{'fraction_non_alphanumeric': 0.12551306977748974, 'fraction_numerical': 0.0028083819399438324, 'mean_word_length': 3.2830712303422755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6561870', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1388, 'n_words': 373}