DialogItem.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 typedef struct RawItemHdr RawItemHdr;
11 
12 //=======================================================================================
14 //=======================================================================================
16  {
33 
36  };
37 
38 //=======================================================================================
43 //=======================================================================================
44 struct DialogItem
45  {
46  /*----------------------------------------------------------------------------------+
47  | Data members
48  +----------------------------------------------------------------------------------*/
51  int itemIndex;
53  BSIRect rect;
55  Point2d origin;
59 
60  /*----------------------------------------------------------------------------------+
61  | Data member / property accessors
62  +----------------------------------------------------------------------------------*/
64  MSCORE_EXPORT DialogItemAttributes const& GetAttributes () const;
65 
67  MSCORE_EXPORT RscId GetId () const;
68 
70  MSCORE_EXPORT int GetItemIndex () const;
71 
73  MSCORE_EXPORT MSDialogP GetDialog () const;
74 
76  MSCORE_EXPORT RawItemHdrP GetRawItem () const;
77 
79  MSCORE_EXPORT BSIRect const& GetRect () const;
80 
82  MSCORE_EXPORT RscType GetType () const;
83 
84  /*----------------------------------------------------------------------------------+
85  | Status retrieval methods
86  +----------------------------------------------------------------------------------*/
88  MSCORE_EXPORT bool HasFocus () const;
89 
91  MSCORE_EXPORT bool IsEnabled () const;
92 
94  MSCORE_EXPORT bool IsFocusable ();
95 
97  MSCORE_EXPORT bool IsDisplayable ();
98 
100  MSCORE_EXPORT bool IsHidden ();
101 
102  /*----------------------------------------------------------------------------------+
103  | Item processing methods
104  +----------------------------------------------------------------------------------*/
107  MSCORE_EXPORT StatusInt Draw (bool eraseFirst=true);
108 
112  MSCORE_EXPORT BSIColorDescr const * GetColor (ItemColorType colorType);
113 
115  MSCORE_EXPORT StatusInt GetLabel (WStringR label);
116 
118  MSCORE_EXPORT int GetLabelLength ();
119 
122  MSCORE_EXPORT int GetLabelWidth (int fontIndex);
123 
125  MSCORE_EXPORT GuiLayoutControlP GetLayoutControl ();
126 
128  MSCORE_EXPORT GuiLayoutPropertiesP GetLayoutProperties ();
129 
133  MSCORE_EXPORT DialogItemP GetNext (bool includeLayoutItems = false);
134 
138  MSCORE_EXPORT DialogItemP GetNextVisible (bool inclusive = false);
139 
142  MSCORE_EXPORT DialogItemP GetOwnerItem ();
143 
145  MSCORE_EXPORT StatusInt GetPopupMenuText (WStringR text);
146 
150  MSCORE_EXPORT DialogItemP GetPrev (bool includeLayoutItems = false);
151 
153  // possibly filtered through a mask associated with the item.
155  // The MSValueDescr struct provides methods to query the type of data and methods to get the data.
156  MSCORE_EXPORT StatusInt GetState (MSValueDescrR state);
157 
159  // appearance when the item is drawn.
161  // The MSValueDescr struct provides methods to query the type of data and methods to get the data.
162  MSCORE_EXPORT StatusInt GetValue (MSValueDescrR value);
163 
165  // appearance when the item is drawn.
167  MSCORE_EXPORT StatusInt GetValue (WStringR value);
168 
171  // out errors (such as the current value being out of range) that may occur if
172  // the item to be hidden has the keyboard focus. It should usually be set to
173  // false which indicates that focus out errors should not be ignored. Defaults to false.
174  MSCORE_EXPORT StatusInt Hide (bool ignoreFocusOutErrors = false);
175 
179  MSCORE_EXPORT StatusInt Move (Point2dP newPtP, bool redraw = true);
180 
182  MSCORE_EXPORT StatusInt Obscure ();
183 
186  MSCORE_EXPORT StatusInt PopupClose (bool update);
187 
189  // set the bGrabMouse to true.
193  MSCORE_EXPORT StatusInt PopupOpen (bool bGrabMouse, Point2dP pPopupPt, MSDialogP *popupDbPP);
194 
197  // reloading the item information. Defaults to true.
198  MSCORE_EXPORT StatusInt ReloadData (bool redraw=true);
199 
203  MSCORE_EXPORT StatusInt SetBalloonText (WCharCP text, bool bSetPopupText=true);
204 
208  MSCORE_EXPORT StatusInt SetColor (ItemColorType colorType, BSIColorDescr *colorP);
209 
212  MSCORE_EXPORT StatusInt SetDisabledBalloonText (WCharCP text);
213 
217  // out errors (such as the current value being out of range) that may occur if
218  // the item to be disabled has the keyboard focus. It should usually be set to
219  // false which indicates that focus out errors should not be ignored. Defaults to false.
220  MSCORE_EXPORT StatusInt SetEnabled (bool enabled, bool ignoreFocusOutErrors = false);
221 
225  MSCORE_EXPORT StatusInt SetExtent (SextentCP sextent, bool redraw=true);
226 
229  MSCORE_EXPORT StatusInt SetFlyoverText (WCharCP text);
230 
233  MSCORE_EXPORT StatusInt SetLabel (WCharCP pwString);
234 
237  MSCORE_EXPORT StatusInt SetLabelFont (int fontIndex);
238 
241  MSCORE_EXPORT StatusInt SetPopupMenuText (WCharCP text);
242 
244  // This is the opposite behavior of Synchronize(), which forces the appearance
245  // and internal value of an item to match its external state.
247  // true if the item's internal value was different than its external state.
249  MSCORE_EXPORT StatusInt SetState (bool* stateChangedP, bool synchOthers = true);
250 
253  // true if the new value is different than the item's old internal value.
255  MSCORE_EXPORT StatusInt SetValue (bool* valueChangedP, MSValueDescrCR newValue);
256 
259  // true if the new value is different than the item's old internal value.
261  MSCORE_EXPORT StatusInt SetValue (bool* valueChangedP, WCharCP newValue);
262 
264  MSCORE_EXPORT StatusInt Show ();
265 
267  // behavior of SetState, which forces the external state of an item to match its appearance.
268  MSCORE_EXPORT StatusInt Synchronize ();
269 
271  // synonym list indicated for this item. All dialogs are processed.
272  MSCORE_EXPORT StatusInt SynchronizeOthers ();
273 
275  MSCORE_EXPORT StatusInt Unobscure ();
276 
277  /*----------------------------------------------------------------------------------+
278  | Template Functions
279  +----------------------------------------------------------------------------------*/
280 
281  /*----------------------------------------------------------------------------------+
282  * @description Returns the specified item type pointer, if appropriate.
283  * For example:
284  *
285  * @code
286  TextBoxP pTextBox = diP->GetTypePtr <TextBoxP> (RTYPE_Text);
287  * @endcode
288  +----------------------------------------------------------------------------------*/
289  template <typename T>
290  T GetTypePtr (RscType itemType)
291  {
292  if (itemType == this->type)
293  return static_cast<T> (this);
294  else
295  return NULL;
296  }
297 
298  /*----------------------------------------------------------------------------------+
299  | Constructor / Destructor
300  +----------------------------------------------------------------------------------*/
304  MSCORE_EXPORT DialogItem();
305 
308  MSCORE_EXPORT ~DialogItem();
309 
310  };
311 
bool IsEnabled() const
Determines if an item is enabled.
StatusInt PopupOpen(bool bGrabMouse, Point2dP pPopupPt, MSDialogP *popupDbPP)
Opens a Popup dialog associated with this item. If the popup should have focus and the mouse then...
UInt32 yPosLocked
Definition: DialogItem.h:27
UInt32 obscured
Definition: DialogItem.h:30
int GetLabelWidth(int fontIndex)
Retrieves the width in pixels of the label for this item.
UInt32 hasFocus
Definition: DialogItem.h:23
UInt32 containsChildItems
Definition: DialogItem.h:29
StatusInt SynchronizeOthers()
Causes a DITEM_MESSAGE_SYNCHRONIZE message to be sent to all items listed in the. ...
DialogItemAttributes const & GetAttributes() const
Returns a reference to the DialogItemAttributes for this DialogItem.
UInt32 unused2
Definition: DialogItem.h:34
StatusInt SetFlyoverText(WCharCP text)
Sets the information displayed in the flyover field in the Status Bar for this item.
BSIRect const & GetRect() const
Returns a reference to the rectangle for this DialogItem. This rectangle is used for mouse processing...
StatusInt SetColor(ItemColorType colorType, BSIColorDescr *colorP)
Sets a specific color for the item.
DialogItem * parentDiP
Parent DialogItem.
Definition: DialogItem.h:58
Dialog Item Attributes.
Definition: DialogItem.h:15
UInt32 unused
Definition: DialogItem.h:32
StatusInt ReloadData(bool redraw=true)
Reloads the item information for this item.
StatusInt GetLabel(WStringR label)
Retrieves the text displayed in the label for this item as a WString.
bool IsDisplayable()
Determines if an item can be displayed.
UInt32 hidden
Definition: DialogItem.h:22
StatusInt SetDisabledBalloonText(WCharCP text)
Sets the text to be displayed in the balloon window when this item is disabled.
RawItemHdr structure - contains info usually specified in item resources and other item type specific...
Definition: dlogitem.h:98
StatusInt Synchronize()
Forces the appearance of an item to match its external state. This is the opposite.
UInt32 enabled
Definition: DialogItem.h:21
StatusInt SetState(bool *stateChangedP, bool synchOthers=true)
Forces the specified item's external state to match its internal value.
bool HasFocus() const
Determines if an item has focus.
GuiLayoutPropertiesP GetLayoutProperties()
Retrieves the GuiLayoutProperties for this item.
StatusInt SetEnabled(bool enabled, bool ignoreFocusOutErrors=false)
Sets the enabled state (enabled or disabled) of a dialog item.
StatusInt SetValue(bool *valueChangedP, MSValueDescrCR newValue)
Sets the internal value of the specified item to a certain value.
wchar_t const * WCharCP
Definition: Bentley.h:224
Sextent extent
Position / size (in dcoord units)
Definition: DialogItem.h:54
RscType GetType() const
Returns the resource type of this DialogItem.
StatusInt PopupClose(bool update)
Notifies the owner item to close its popup window.
BSIRect rect
mouse sensitive/update region of item
Definition: DialogItem.h:53
StatusInt GetValue(MSValueDescrR value)
Retrieves this item's internal value. This is the value that is used to determine the item's...
uint32_t UInt32
Definition: Bentley.r.h:128
struct Bentley::WString & WStringR
Definition: Bentley.h:239
#define NULL
Definition: Bentley.h:157
DialogItemP GetPrev(bool includeLayoutItems=false)
Retrieves the previous item in the dialog item list.
int GetItemIndex() const
Returns the index within the MSDialog of this DialogItem.
uint32_t RscType
Definition: ecimagekey.h:15
StatusInt SetBalloonText(WCharCP text, bool bSetPopupText=true)
Sets the information displayed in the balloon window for this item.
Sextent const * SextentCP
Definition: MicroStation.r.h:744
UInt32 acceptsKeystrokes
Definition: DialogItem.h:17
StatusInt Unobscure()
Unobscures the item. The Obscure method obscures the item.
StatusInt GetPopupMenuText(WStringR text)
Retrieves the text displayed in the Show/Hide PopupMenu.
StatusInt Show()
Shows a previously hidden item.
RscId GetId() const
Returns the id of this DialogItem.
StatusInt GetState(MSValueDescrR state)
Retrieves this item's external state. This is the value of the application data that the item control...
Definition: MicroStation.r.h:734
BSIColorDescr const * GetColor(ItemColorType colorType)
Gets a specific color for the item.
StatusInt SetLabel(WCharCP pwString)
Sets the label of an item.
GuiLayoutControlP GetLayoutControl()
Retrieves the GuiLayoutControl for this item.
DialogItem()
Constructs a DialogItem object.
StatusInt SetLabelFont(int fontIndex)
Sets the font used for the label of this item.
UInt32 xPosLocked
Definition: DialogItem.h:26
UInt32 created
Definition: DialogItem.h:31
bool IsFocusable()
Determines if an item is focusable.
RawItemHdr * rawItemP
RawItemHdr associated with this DialogItem.
Definition: DialogItem.h:57
StatusInt SetExtent(SextentCP sextent, bool redraw=true)
Sets the extent (position and size) of an item within the dialog.
uint64_t UInt64
Definition: Bentley.r.h:131
DialogItem represents a dialog item in a MicroStation/PowerPlatform dialog box.
Definition: DialogItem.h:44
int GetLabelLength()
Retrieves the length in characters of the label for this item.
UInt32 canHaveSynonyms
Definition: DialogItem.h:20
DialogItemP GetNextVisible(bool inclusive=false)
Retrieves the next visible item in the dialog item list.
MSDialogP GetDialog() const
Returns a pointer to the MSDialog that is hosting this DialogItem.
int StatusInt
Definition: Bentley.h:222
UInt32 unused3
Definition: DialogItem.h:35
UInt32 mouseSensitive
Definition: DialogItem.h:18
ItemColorType
Definition: MstnDefs.h:278
DialogItemP GetNext(bool includeLayoutItems=false)
Retrieves the next item in the dialog item list.
bool IsHidden()
Determines if an item is hidden.
StatusInt Move(Point2dP newPtP, bool redraw=true)
Moves an item within the Dialog Box.
RscType type
type of item, ie. RTYPE_PushButton
Definition: DialogItem.h:49
Point2d origin
Position (in dcoord units)
Definition: DialogItem.h:55
StatusInt Hide(bool ignoreFocusOutErrors=false)
Hides an item within the Dialog Box.
StatusInt Draw(bool eraseFirst=true)
Redraws an item within the Dialog Box.
DialogItemAttributes attributes
Attributes from the resource.
Definition: DialogItem.h:56
UInt64 itemArg
item arg
Definition: DialogItem.h:52
T GetTypePtr(RscType itemType)
Definition: DialogItem.h:290
StatusInt SetPopupMenuText(WCharCP text)
Sets the text displayed in the Show/Hide PopupMenu.
struct colordescr BSIColorDescr
Definition: MicroStation.r.h:30
int32_t RscId
Definition: ecimagekey.h:16
RscId id
id of item
Definition: DialogItem.h:50
DialogItemP GetOwnerItem()
Retrieves the DialogItem pointer of the owning dialog item, if any.
~DialogItem()
Destructs a DialogItem object.
int itemIndex
index within parent
Definition: DialogItem.h:51
RawItemHdrP GetRawItem() const
Returns a pointer to the RawItemHdr associated with this DialogItem.
UInt32 updateFlag
Definition: DialogItem.h:24
UInt32 traversable
Definition: DialogItem.h:19
StatusInt Obscure()
Obscures the item. Unobscure() reverses this process.
UInt32 containsIconCommand
Definition: DialogItem.h:28

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.