ginebra2/ChromeLayout.cpp
author hgs
Fri, 06 Aug 2010 17:23:08 -0400
changeset 9 b39122337a00
parent 3 0954f5dd2cd0
child 16 3c88a81ff781
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
*
hgs
parents:
diff changeset
     5
* This program is free software: you can redistribute it and/or modify
hgs
parents:
diff changeset
     6
* it under the terms of the GNU Lesser General Public License as published by
hgs
parents:
diff changeset
     7
* the Free Software Foundation, version 2.1 of the License.
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* This program is distributed in the hope that it will be useful,
hgs
parents:
diff changeset
    10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
hgs
parents:
diff changeset
    11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
hgs
parents:
diff changeset
    12
* GNU Lesser General Public License for more details.
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* You should have received a copy of the GNU Lesser General Public License
hgs
parents:
diff changeset
    15
* along with this program.  If not,
hgs
parents:
diff changeset
    16
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
hgs
parents:
diff changeset
    17
*
hgs
parents:
diff changeset
    18
* Description:
hgs
parents:
diff changeset
    19
*
hgs
parents:
diff changeset
    20
*/
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#include <QList>
hgs
parents:
diff changeset
    23
#include <QDebug>
hgs
parents:
diff changeset
    24
#include <QGraphicsSceneContextMenuEvent>
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
#include "ChromeSnippet.h"
hgs
parents:
diff changeset
    27
#include "WebChromeContainerSnippet.h"
hgs
parents:
diff changeset
    28
#include "ChromeLayout.h"
hgs
parents:
diff changeset
    29
#include "SlidingWidget.h"
hgs
parents:
diff changeset
    30
#include "ViewController.h"
hgs
parents:
diff changeset
    31
#include "ObjectCharm.h"
hgs
parents:
diff changeset
    32
#include "bedrockprovisioning.h"
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
namespace GVA {
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
// -----------------------------
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
  ChromeLayout::ChromeLayout(QGraphicsItem * parent, Qt::WindowFlags wFlags)
hgs
parents:
diff changeset
    39
    : QGraphicsWidget(parent, wFlags),
hgs
parents:
diff changeset
    40
      m_topBar(0),
hgs
parents:
diff changeset
    41
      m_bottomBar(0),
hgs
parents:
diff changeset
    42
      m_leftBar(0),
hgs
parents:
diff changeset
    43
      m_rightBar(0),
hgs
parents:
diff changeset
    44
      m_aspect(portrait),
hgs
parents:
diff changeset
    45
      m_bottomBarHeight(0)
hgs
parents:
diff changeset
    46
  {
hgs
parents:
diff changeset
    47
    m_layout = new QGraphicsAnchorLayout();
hgs
parents:
diff changeset
    48
    m_layout->setContentsMargins(0,0,0,0);
hgs
parents:
diff changeset
    49
    m_layout->setSpacing(0);
hgs
parents:
diff changeset
    50
    setLayout(m_layout);
hgs
parents:
diff changeset
    51
    addAnchors();
hgs
parents:
diff changeset
    52
    m_viewPort = new SlidingWidget(this);
hgs
parents:
diff changeset
    53
    m_layout->addAnchor(m_viewPort, Qt::AnchorTop, m_topBar, Qt::AnchorBottom);
hgs
parents:
diff changeset
    54
    m_layout->addAnchor(m_viewPort, Qt::AnchorBottom, m_bottomBar, Qt::AnchorTop);
hgs
parents:
diff changeset
    55
    m_layout->addAnchor(m_viewPort, Qt::AnchorLeft, m_leftBar, Qt::AnchorRight);
hgs
parents:
diff changeset
    56
    m_layout->addAnchor(m_viewPort, Qt::AnchorRight, m_rightBar, Qt::AnchorLeft);
hgs
parents:
diff changeset
    57
  }
hgs
parents:
diff changeset
    58
  
hgs
parents:
diff changeset
    59
  ChromeLayout::~ChromeLayout()
hgs
parents:
diff changeset
    60
  {
hgs
parents:
diff changeset
    61
    delete m_bottomBar;
hgs
parents:
diff changeset
    62
    delete m_topBar;
hgs
parents:
diff changeset
    63
    delete m_leftBar;
hgs
parents:
diff changeset
    64
    delete m_rightBar;
hgs
parents:
diff changeset
    65
    delete m_viewPort;
hgs
parents:
diff changeset
    66
  }
hgs
parents:
diff changeset
    67
  
hgs
parents:
diff changeset
    68
  void ChromeLayout::addAnchors(){
hgs
parents:
diff changeset
    69
    if (!m_bottomBar){
hgs
parents:
diff changeset
    70
      m_bottomBar = new QGraphicsWidget(this);
hgs
parents:
diff changeset
    71
      m_bottomBar->setPreferredHeight(0);
hgs
parents:
diff changeset
    72
      m_bottomBar->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
hgs
parents:
diff changeset
    73
      m_layout->addAnchor(m_bottomBar, Qt::AnchorBottom, m_layout, Qt::AnchorBottom);
hgs
parents:
diff changeset
    74
      m_layout->addAnchors(m_bottomBar, m_layout, Qt::Horizontal);
hgs
parents:
diff changeset
    75
    }
hgs
parents:
diff changeset
    76
    if (!m_topBar){
hgs
parents:
diff changeset
    77
      m_topBar = new QGraphicsWidget(this);
hgs
parents:
diff changeset
    78
      m_topBar->setPreferredHeight(0);
hgs
parents:
diff changeset
    79
      m_topBar->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
hgs
parents:
diff changeset
    80
      m_layout->addAnchor(m_topBar, Qt::AnchorTop, m_layout, Qt::AnchorTop);
hgs
parents:
diff changeset
    81
      m_layout->addAnchors(m_topBar, m_layout, Qt::Horizontal);
hgs
parents:
diff changeset
    82
    }
hgs
parents:
diff changeset
    83
    if (!m_leftBar){
hgs
parents:
diff changeset
    84
      m_leftBar = new QGraphicsWidget(this);
hgs
parents:
diff changeset
    85
      m_leftBar->setPreferredWidth(0);
hgs
parents:
diff changeset
    86
      m_leftBar->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
hgs
parents:
diff changeset
    87
      m_layout->addAnchor(m_leftBar, Qt::AnchorLeft, m_layout, Qt::AnchorLeft);
hgs
parents:
diff changeset
    88
      m_layout->addAnchors(m_leftBar, m_layout, Qt::Vertical);
hgs
parents:
diff changeset
    89
    }
hgs
parents:
diff changeset
    90
    if (!m_rightBar){
hgs
parents:
diff changeset
    91
      m_rightBar = new QGraphicsWidget(this);
hgs
parents:
diff changeset
    92
      m_rightBar->setPreferredWidth(0);
hgs
parents:
diff changeset
    93
      m_rightBar->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
hgs
parents:
diff changeset
    94
      m_layout->addAnchor(m_rightBar, Qt::AnchorRight, m_layout, Qt::AnchorRight);
hgs
parents:
diff changeset
    95
      m_layout->addAnchors(m_rightBar, m_layout, Qt::Vertical);
hgs
parents:
diff changeset
    96
    }
hgs
parents:
diff changeset
    97
  }
hgs
parents:
diff changeset
    98
  
hgs
parents:
diff changeset
    99
  void ChromeLayout::resizeEvent(QGraphicsSceneResizeEvent *ev)
hgs
parents:
diff changeset
   100
  {
hgs
parents:
diff changeset
   101
    emit resizing(ev->newSize());
hgs
parents:
diff changeset
   102
    int aspect = m_aspect;
hgs
parents:
diff changeset
   103
    m_aspect = (ev->newSize().width() > ev->newSize().height())?landscape:portrait;
hgs
parents:
diff changeset
   104
    if (m_aspect != aspect) {
hgs
parents:
diff changeset
   105
      QString mode = (m_aspect == landscape ? "Landscape" : "Portrait");
hgs
parents:
diff changeset
   106
      emit aspectChanged(m_aspect);
hgs
parents:
diff changeset
   107
    }
hgs
parents:
diff changeset
   108
    QGraphicsWidget::resizeEvent(ev);
hgs
parents:
diff changeset
   109
  }
hgs
parents:
diff changeset
   110
  
hgs
parents:
diff changeset
   111
  void ChromeLayout::addView(ControllableViewBase * controllableView){
hgs
parents:
diff changeset
   112
    if (controllableView->widget()) {
hgs
parents:
diff changeset
   113
      m_viewPort->setWindow(controllableView->widget());
hgs
parents:
diff changeset
   114
      controllableView->widget()->setFocusPolicy(Qt::ClickFocus); //NB: Is this needed? Does it break anything?
hgs
parents:
diff changeset
   115
      controllableView->widget()->setZValue(-1.0); //Make sure we are behind any center anchored snippets
hgs
parents:
diff changeset
   116
    }
hgs
parents:
diff changeset
   117
  }
hgs
parents:
diff changeset
   118
  
hgs
parents:
diff changeset
   119
  void ChromeLayout::anchorToView(ChromeSnippet* snippet, const QString& where)
hgs
parents:
diff changeset
   120
  {
hgs
parents:
diff changeset
   121
    Q_UNUSED(where)
hgs
parents:
diff changeset
   122
      m_viewPort->attachItem(snippet->widget());
hgs
parents:
diff changeset
   123
  }
hgs
parents:
diff changeset
   124
  
hgs
parents:
diff changeset
   125
  void ChromeLayout::detachFromView(ChromeSnippet* snippet, const QString& where)
hgs
parents:
diff changeset
   126
  {
hgs
parents:
diff changeset
   127
    Q_UNUSED(where)
hgs
parents:
diff changeset
   128
      m_viewPort->detachItem(snippet->widget());
hgs
parents:
diff changeset
   129
  }
hgs
parents:
diff changeset
   130
  
hgs
parents:
diff changeset
   131
  void ChromeLayout::anchorTogether(ChromeSnippet * first, ChromeSnippet * second, qreal x, qreal y)
hgs
parents:
diff changeset
   132
  {
hgs
parents:
diff changeset
   133
      first->widget()->setParentItem(second->widget());
hgs
parents:
diff changeset
   134
      first->widget()->setPos(x,y);
hgs
parents:
diff changeset
   135
  }
hgs
parents:
diff changeset
   136
  
hgs
parents:
diff changeset
   137
  void ChromeLayout::unAnchor(ChromeSnippet* snippet)
hgs
parents:
diff changeset
   138
  {
hgs
parents:
diff changeset
   139
    snippet->widget()->setParentItem(0);
hgs
parents:
diff changeset
   140
    snippet->widget()->setParentItem(this);
hgs
parents:
diff changeset
   141
  }
hgs
parents:
diff changeset
   142
  
hgs
parents:
diff changeset
   143
  qreal ChromeLayout::shrinkView(qreal delta)
hgs
parents:
diff changeset
   144
  {
hgs
parents:
diff changeset
   145
    m_viewPort->setShrinkMax(bottomBarHeight());
hgs
parents:
diff changeset
   146
    return m_viewPort->shrink(delta);
hgs
parents:
diff changeset
   147
  }
hgs
parents:
diff changeset
   148
  
hgs
parents:
diff changeset
   149
  qreal ChromeLayout::slideView(qreal delta)
hgs
parents:
diff changeset
   150
  {
hgs
parents:
diff changeset
   151
    return m_viewPort->slide(delta);
hgs
parents:
diff changeset
   152
  }
hgs
parents:
diff changeset
   153
  
hgs
parents:
diff changeset
   154
  //Check to see if snippet has an anchor and lay it out accordingly.
hgs
parents:
diff changeset
   155
  //Otherwise snippets determine their own positions from html
hgs
parents:
diff changeset
   156
  
hgs
parents:
diff changeset
   157
  void ChromeLayout::anchorSnippet(ChromeSnippet * snippet)
hgs
parents:
diff changeset
   158
  {
hgs
parents:
diff changeset
   159
    if (snippet->anchor() == anchorBottom){
hgs
parents:
diff changeset
   160
      if (snippet->hidesContent()){
hgs
parents:
diff changeset
   161
	m_layout->addAnchor(snippet->widget(), Qt::AnchorBottom, m_bottomBar, Qt::AnchorTop);
hgs
parents:
diff changeset
   162
	m_layout->addAnchor(snippet->widget(), Qt::AnchorHorizontalCenter, m_bottomBar, Qt::AnchorHorizontalCenter);
hgs
parents:
diff changeset
   163
      } else {
hgs
parents:
diff changeset
   164
	snippet->widget()->setParentItem(m_bottomBar);
hgs
parents:
diff changeset
   165
	snippet->widget()->setY(-snippet->anchorOffset());
hgs
parents:
diff changeset
   166
      }
hgs
parents:
diff changeset
   167
    }
hgs
parents:
diff changeset
   168
    else if (snippet->anchor() == anchorTop){
hgs
parents:
diff changeset
   169
      if (snippet->hidesContent()){
hgs
parents:
diff changeset
   170
	m_layout->addAnchor(snippet->widget(),Qt::AnchorTop, m_topBar, Qt::AnchorBottom);
hgs
parents:
diff changeset
   171
	m_layout->addAnchor(snippet->widget(), Qt::AnchorHorizontalCenter, m_topBar, Qt::AnchorHorizontalCenter);
hgs
parents:
diff changeset
   172
      }
hgs
parents:
diff changeset
   173
      else {
hgs
parents:
diff changeset
   174
	snippet->widget()->setParentItem(m_topBar);
hgs
parents:
diff changeset
   175
	snippet->widget()->setY(snippet->anchorOffset());
hgs
parents:
diff changeset
   176
      }
hgs
parents:
diff changeset
   177
    }
hgs
parents:
diff changeset
   178
    else if (snippet->anchor() == anchorLeft){
hgs
parents:
diff changeset
   179
      if (snippet->hidesContent())
hgs
parents:
diff changeset
   180
	m_layout->addAnchor(snippet->widget(),Qt::AnchorLeft, m_leftBar, Qt::AnchorRight);
hgs
parents:
diff changeset
   181
      else {
hgs
parents:
diff changeset
   182
	snippet->widget()->setParentItem(m_leftBar);
hgs
parents:
diff changeset
   183
	snippet->widget()->setX(snippet->anchorOffset());
hgs
parents:
diff changeset
   184
      }
hgs
parents:
diff changeset
   185
    }
hgs
parents:
diff changeset
   186
    else if (snippet->anchor() == anchorRight){
hgs
parents:
diff changeset
   187
      if (snippet->hidesContent())
hgs
parents:
diff changeset
   188
	m_layout->addAnchor(snippet->widget(),Qt::AnchorRight, m_rightBar, Qt::AnchorLeft);
hgs
parents:
diff changeset
   189
      else {
hgs
parents:
diff changeset
   190
	snippet->widget()->setParentItem(m_rightBar);
hgs
parents:
diff changeset
   191
	snippet->widget()->setX(-snippet->anchorOffset());
hgs
parents:
diff changeset
   192
      }
hgs
parents:
diff changeset
   193
    }
hgs
parents:
diff changeset
   194
    else if (snippet->anchor() == anchorCenter) {
hgs
parents:
diff changeset
   195
      snippet->widget()->setParentItem(m_viewPort);
hgs
parents:
diff changeset
   196
      snippet->widget()->setZValue(0.0);
hgs
parents:
diff changeset
   197
      QGraphicsAnchorLayout * vl = static_cast<QGraphicsAnchorLayout*>(m_viewPort->layout());
hgs
parents:
diff changeset
   198
      vl->addAnchor(snippet->widget(), Qt::AnchorVerticalCenter, vl, Qt::AnchorVerticalCenter);
hgs
parents:
diff changeset
   199
      vl->addAnchor(snippet->widget(), Qt::AnchorHorizontalCenter, vl, Qt::AnchorHorizontalCenter);
hgs
parents:
diff changeset
   200
    }
hgs
parents:
diff changeset
   201
    else if (snippet->anchor() == anchorTopLeft){
hgs
parents:
diff changeset
   202
      m_layout->addCornerAnchors(snippet->widget(), Qt::TopLeftCorner, m_layout, Qt::TopLeftCorner);
hgs
parents:
diff changeset
   203
    }
hgs
parents:
diff changeset
   204
    else if (snippet->anchor() == anchorTopRight)
hgs
parents:
diff changeset
   205
      m_layout->addCornerAnchors(snippet->widget(), Qt::TopRightCorner, m_layout, Qt::TopRightCorner);
hgs
parents:
diff changeset
   206
    else if (snippet->anchor() == anchorBottomLeft)
hgs
parents:
diff changeset
   207
      m_layout->addCornerAnchors(snippet->widget(), Qt::BottomLeftCorner, m_layout, Qt::BottomLeftCorner);
hgs
parents:
diff changeset
   208
    else if (snippet->anchor() == anchorBottomRight)
hgs
parents:
diff changeset
   209
      m_layout->addCornerAnchors(snippet->widget(), Qt::BottomRightCorner, m_layout, Qt::BottomRightCorner);
hgs
parents:
diff changeset
   210
  }
hgs
parents:
diff changeset
   211
  
hgs
parents:
diff changeset
   212
  void ChromeLayout:: addSnippet(ChromeSnippet * snippet, ChromeSnippet * container )
hgs
parents:
diff changeset
   213
  {
hgs
parents:
diff changeset
   214
    snippet->widget()->setParentItem(this);
hgs
parents:
diff changeset
   215
    if (container){
hgs
parents:
diff changeset
   216
	container->addChild(snippet);
hgs
parents:
diff changeset
   217
    }
hgs
parents:
diff changeset
   218
    anchorSnippet(snippet);
hgs
parents:
diff changeset
   219
  }
hgs
parents:
diff changeset
   220
  
hgs
parents:
diff changeset
   221
  // Call after a snippet changes to visible state
hgs
parents:
diff changeset
   222
    
hgs
parents:
diff changeset
   223
  void ChromeLayout::snippetShown(ChromeSnippet * snippet)
hgs
parents:
diff changeset
   224
  {
hgs
parents:
diff changeset
   225
    if (snippet->hidesContent()) {
hgs
parents:
diff changeset
   226
      if (snippet->anchor() == anchorBottom) {
hgs
parents:
diff changeset
   227
	/* snippet->widget()->size().height() is zero for  WebChromeContainerSnippet
hgs
parents:
diff changeset
   228
	   when default visible container snippet is shown, get ownerArea height instead */
hgs
parents:
diff changeset
   229
	WebChromeContainerSnippet * s = dynamic_cast<WebChromeContainerSnippet *>(snippet);
hgs
parents:
diff changeset
   230
	if (!s) {
hgs
parents:
diff changeset
   231
	  m_bottomBarHeight = snippet->widget()->size().height();
hgs
parents:
diff changeset
   232
	}
hgs
parents:
diff changeset
   233
	else {
hgs
parents:
diff changeset
   234
	  m_bottomBarHeight = s->ownerArea().height();
hgs
parents:
diff changeset
   235
	}
hgs
parents:
diff changeset
   236
      }
hgs
parents:
diff changeset
   237
      return;
hgs
parents:
diff changeset
   238
    }
hgs
parents:
diff changeset
   239
    if (snippet->anchor() == anchorBottom)
hgs
parents:
diff changeset
   240
      m_bottomBar->setPreferredHeight(m_bottomBar->preferredHeight() + snippet->widget()->preferredHeight());
hgs
parents:
diff changeset
   241
    else if (snippet->anchor() == anchorTop)
hgs
parents:
diff changeset
   242
      m_topBar->setPreferredHeight(m_topBar->preferredHeight() + snippet->widget()->preferredHeight());
hgs
parents:
diff changeset
   243
    else if (snippet->anchor() == anchorLeft){
hgs
parents:
diff changeset
   244
      m_leftBar->setPreferredWidth(m_leftBar->preferredWidth() + snippet->widget()->preferredWidth());
hgs
parents:
diff changeset
   245
    }
hgs
parents:
diff changeset
   246
    else if (snippet->anchor() == anchorRight){
hgs
parents:
diff changeset
   247
      m_rightBar->setPreferredWidth(m_rightBar->preferredWidth() + snippet->widget()->preferredWidth());
hgs
parents:
diff changeset
   248
    }
hgs
parents:
diff changeset
   249
  }
hgs
parents:
diff changeset
   250
  
hgs
parents:
diff changeset
   251
  // Call before a snippet changes to invisible state
hgs
parents:
diff changeset
   252
    
hgs
parents:
diff changeset
   253
  void ChromeLayout::snippetHiding(ChromeSnippet * snippet)
hgs
parents:
diff changeset
   254
  {
hgs
parents:
diff changeset
   255
    if (snippet->hidesContent())
hgs
parents:
diff changeset
   256
      return;
hgs
parents:
diff changeset
   257
    if (snippet->anchor() == anchorBottom)
hgs
parents:
diff changeset
   258
      m_bottomBar->setPreferredHeight(m_bottomBar->preferredHeight() - snippet->widget()->preferredHeight());
hgs
parents:
diff changeset
   259
    else if (snippet->anchor() == anchorTop)
hgs
parents:
diff changeset
   260
      m_topBar->setPreferredHeight(m_topBar->preferredHeight() - snippet->widget()->preferredHeight());
hgs
parents:
diff changeset
   261
    else if (snippet->anchor() == anchorLeft){
hgs
parents:
diff changeset
   262
      m_leftBar->setPreferredWidth(m_leftBar->preferredWidth() - snippet->widget()->preferredWidth());
hgs
parents:
diff changeset
   263
    }
hgs
parents:
diff changeset
   264
    else if (snippet->anchor() == anchorRight){
hgs
parents:
diff changeset
   265
      m_rightBar->setPreferredWidth(m_rightBar->preferredWidth() - snippet->widget()->preferredWidth());
hgs
parents:
diff changeset
   266
    }
hgs
parents:
diff changeset
   267
  }
hgs
parents:
diff changeset
   268
  
hgs
parents:
diff changeset
   269
  QString ChromeLayout::getDisplayMode() const {
hgs
parents:
diff changeset
   270
    return (m_aspect==portrait)?"portrait":"landscape";
hgs
parents:
diff changeset
   271
  }
hgs
parents:
diff changeset
   272
  
hgs
parents:
diff changeset
   273
  void ChromeLayout::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
hgs
parents:
diff changeset
   274
  {
hgs
parents:
diff changeset
   275
    event->accept();
hgs
parents:
diff changeset
   276
  }
hgs
parents:
diff changeset
   277
hgs
parents:
diff changeset
   278
  //NB: Deprecate. This really shouldn't be necessary: anchor bars should be implemented as an expanding
hgs
parents:
diff changeset
   279
  //widget class.
hgs
parents:
diff changeset
   280
hgs
parents:
diff changeset
   281
  void ChromeLayout::adjustAnchorOffset(ChromeSnippet * snippet, qreal delta)
hgs
parents:
diff changeset
   282
  {
hgs
parents:
diff changeset
   283
    if (snippet->anchor() == anchorBottom)
hgs
parents:
diff changeset
   284
      m_bottomBar->setPreferredHeight(m_bottomBar->preferredHeight() + delta);
hgs
parents:
diff changeset
   285
    else if (snippet->anchor() == anchorTop)
hgs
parents:
diff changeset
   286
      m_topBar->setPreferredHeight(m_topBar->preferredHeight() + delta);
hgs
parents:
diff changeset
   287
    else if (snippet->anchor() == anchorLeft){
hgs
parents:
diff changeset
   288
      m_leftBar->setPreferredWidth(m_leftBar->preferredWidth() + delta);
hgs
parents:
diff changeset
   289
    }
hgs
parents:
diff changeset
   290
    else if (snippet->anchor() == anchorRight){
hgs
parents:
diff changeset
   291
      m_rightBar->setPreferredWidth(m_rightBar->preferredWidth() + delta);
hgs
parents:
diff changeset
   292
    }
hgs
parents:
diff changeset
   293
  }
hgs
parents:
diff changeset
   294
hgs
parents:
diff changeset
   295
  void ChromeLayout::setScene(QGraphicsScene *scene)
hgs
parents:
diff changeset
   296
  {
hgs
parents:
diff changeset
   297
    m_scene = scene;
hgs
parents:
diff changeset
   298
    //This is the root of the scene hierarchy
hgs
parents:
diff changeset
   299
    m_scene->addItem(this);
hgs
parents:
diff changeset
   300
hgs
parents:
diff changeset
   301
    // For testing, turn on red dot that appears in response to various mouse events.
hgs
parents:
diff changeset
   302
    if(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("EnableTouchCircle", false)) {
hgs
parents:
diff changeset
   303
        new TouchCircleCharm(m_scene, this);
hgs
parents:
diff changeset
   304
    }
hgs
parents:
diff changeset
   305
hgs
parents:
diff changeset
   306
  }
hgs
parents:
diff changeset
   307
  
hgs
parents:
diff changeset
   308
} // endof namespace GVA