OpShowState Class Reference

Will cut down the size of a bar to the number of buttons requested by deleting the last buttons in the bar. More...

#include <opdupbar.h>

Inheritance diagram for OpShowState:

UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpShowState ()
void DoWithParam (OpDescriptor *token, OpParam *pOpParam)

Static Public Member Functions

static BOOL Init ()
 OpShowState initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the operations state.
static void ShowState (INT32 ShowLayer, UndoableOperation *pOp)

Detailed Description

Will cut down the size of a bar to the number of buttons requested by deleting the last buttons in the bar.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/10/99

Definition at line 269 of file opdupbar.h.


Constructor & Destructor Documentation

OpShowState::OpShowState  ) 
 

Definition at line 1127 of file opdupbar.cpp.

01127                         : UndoableOperation()                               
01128 {                              
01129 }


Member Function Documentation

void OpShowState::DoWithParam OpDescriptor token,
OpParam pOpParam
[virtual]
 

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/00
Parameters:
OpParam - Param1 has the layer/state id in it [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Reimplemented from Operation.

Definition at line 1198 of file opdupbar.cpp.

01199 {
01200     // Delete the bar
01201     ShowState(pOpParam->Param1, this);
01202 
01203     // end the op
01204     End();
01205 
01206     DialogBarOp::SetSystemStateChanged();
01207     DialogBarOp::UpdateStateOfAllBars(); 
01208 }

OpState OpShowState::GetState String_256 UIDescription,
OpDescriptor Bob
[static]
 

For finding the operations state.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com> based on Jason
Date:
6/7/00

Definition at line 1174 of file opdupbar.cpp.

01175 {
01176     OpState OpSt;
01177 
01178     // if we don't allow it
01179     OpSt.Greyed = TRUE;
01180     Spread* pSpread = Document::GetSelectedSpread();
01181     if (pSpread && !pSpread->FindActiveLayer()->IsFrame())
01182         OpSt.Greyed = FALSE;
01183 
01184     return(OpSt);   
01185 }

BOOL OpShowState::Init void   )  [static]
 

OpShowState initialiser method.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/00
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 1144 of file opdupbar.cpp.

01145 {
01146     return  (RegisterOpDescriptor(0,
01147                                 _R(IDS_SHOWSTATEOP),
01148                                 CC_RUNTIME_CLASS(OpShowState),
01149                                 OPTOKEN_SHOWSTATE,
01150                                 OpShowState::GetState,
01151                                 0,                  // help ID 
01152                                 0,                  // bubble help
01153                                 0,                  // resource ID
01154                                 0,                  // control ID
01155                                 SYSTEMBAR_ILLEGAL,  // Bar ID
01156                                 TRUE,               // Receive messages
01157                                 FALSE,
01158                                 FALSE,
01159                                 0,
01160                                 (GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE) ));
01161 }

void OpShowState::ShowState INT32  ShowLayer,
UndoableOperation pOp
[static]
 

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/00
Parameters:
ShowLayer - number of the specail layers to display 0 = mouseoff, 1 = mouseover, 2= clicked, 3 = selected, 4 = all the above [INPUTS] pOp - Unodable Op to use, can be NULL in which case not undoable.
- [OUTPUTS]
Returns:
-

Definition at line 1222 of file opdupbar.cpp.

01223 {
01224     Spread* pSelSpread = Document::GetSelectedSpread();
01225     if (pSelSpread == NULL)
01226         return;
01227 
01228     String_32 StateName[4];
01229 
01230     StateName[DEFAULT].Load(_R(IDS_ROLLOVER_DEFAULT)); // = "Default";
01231     StateName[MOUSE].Load(_R(IDS_ROLLOVER_MOUSE)); // = "Mouse";
01232     StateName[CLICKED].Load(_R(IDS_ROLLOVER_CLICKED)); // = "Clicked";
01233     StateName[SELECTED].Load(_R(IDS_ROLLOVER_SELECTED)); // = "Selected";
01234 
01235     Layer * pLayer = pSelSpread->FindFirstLayer();
01236 
01237     Layer * pLayerTopLayer = NULL;
01238     BOOL ActiveLayerIsAState = FALSE;
01239     BOOL SetAnActiveLayer = FALSE;
01240 
01241     DocRect InvalidRect;
01242 
01243     InvalidRect.MakeEmpty();
01244 
01245     while (pLayer)
01246     {
01247         BOOL IsStateLayer = FALSE;
01248         INT32 i = 0;
01249         for (i = 0; i < 4 ; i++)
01250         {
01251             if (pLayer->GetLayerID().CompareTo(StateName[i]) == 0)
01252             {
01253                 IsStateLayer = TRUE;
01254                 if (ShowLayer == 4 /* show all layers at once */
01255                     || ShowLayer == i)
01256                 {
01257                     if (!pLayer->IsVisible())
01258                     {
01259                         if (pOp)
01260                             SliceHelper::ShowLayer(TRUE, pLayer, pSelSpread, pOp);
01261                         else
01262                             pLayer->SetVisible(TRUE);
01263 
01264                         InvalidRect = InvalidRect.Union(pLayer->GetBoundingRect());
01265                     }
01266                 }
01267                 else
01268                 {
01269                     if (pLayer->IsVisible())
01270                     {
01271                         if (pOp)
01272                             SliceHelper::ShowLayer(FALSE, pLayer, pSelSpread, pOp);
01273                         else
01274                             pLayer->SetVisible(FALSE);
01275 
01276                         InvalidRect = InvalidRect.Union(pLayer->GetBoundingRect());
01277                         // If layer has just about to become invisible,
01278                         // remove the selections on the layer 
01279                         //NodeRenderableInk::DeselectAllOnLayer(pLayer); 
01280                     }
01281                 }
01282 
01283                 if (pLayer->IsActive())
01284                     ActiveLayerIsAState = TRUE;
01285             }
01286         }
01287 
01288         if (pLayer->IsVisible() && !IsStateLayer)
01289             pLayerTopLayer = pLayer;
01290 
01291         pLayer = pLayer->FindNextLayer();
01292     }
01293 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:58:57 2007 for Camelot by  doxygen 1.4.4