#include <stdbars.h>
Inheritance diagram for StandardBar:
Public Member Functions | |
StandardBar () | |
virtual MsgResult | Message (Msg *Msg) |
Standard Message processor. | |
void | Do (OpDescriptor *pOpDesc) |
Show or hide the bar (when invoked). | |
BOOL | Create (ResourceID dlg) |
Show the bar (when invoked). | |
BOOL | IsABar () |
BOOL | IsVertical () |
Static Public Member Functions | |
static BOOL | Init () |
Show the bar (when invoked). | |
static OpState | GetState (String_256 *, OpDescriptor *pOpDesc) |
GetState method. | |
static void | BroadcastClose (OpDescriptor *pOpDesc) |
GetState method. | |
Public Attributes | |
BOOL | m_Vertical |
OpDescriptor * | m_pOpDesc |
Definition at line 140 of file stdbars.h.
|
Definition at line 145 of file stdbars.h. 00145 : DialogOp ( (ResourceID) 0, MODELESS) {m_Vertical = FALSE; m_pOpDesc = NULL;}
|
|
GetState method.
Definition at line 198 of file stdbars.cpp. 00199 { 00200 if (MessageHandler::MessageHandlerExists(CC_RUNTIME_CLASS(StandardBar))) 00201 { 00202 // Send all message handlers of our class a message 00203 // For some reason we have to send it to all DialogOps - apparently we can't broadcast to a subclass 00204 BROADCAST_TO_CLASS(StandardBarMsg(pOpDesc, StandardBarMsg::CLOSE), DialogOp); 00205 } 00206 }
|
|
Show the bar (when invoked).
Definition at line 340 of file stdbars.cpp. 00341 { 00342 DlgResID = dlg; // Fortunately nothing needs this earlier 00343 00344 // A quick hack to make the toolbar dock vertically 00345 m_Vertical = (dlg == _R(IDD_BUTTBAR_TOOLBAR))?TRUE:FALSE; 00346 00347 if (DialogOp::Create()) 00348 { 00349 // Set up your gadgets here 00350 00351 return TRUE; 00352 } 00353 else return FALSE; 00354 }
|
|
Show or hide the bar (when invoked).
Reimplemented from Operation. Definition at line 372 of file stdbars.cpp. 00373 { 00374 // First translate the bitmap button ID (which we use to determine which opdescriptor invoked 00375 // us) into a dialog ID 00376 00377 ResourceID dlg = CamResource::GetResourceID((const TCHAR *)(pOpDesc->Token)); 00378 00379 if (dlg) 00380 { 00381 String_256 dummy; 00382 if (!GetState(&dummy,pOpDesc).Ticked) 00383 { 00384 m_pOpDesc = pOpDesc; // For identifying the OpDescriptor 00385 Create(dlg); 00386 Open(); 00387 } 00388 else 00389 { 00390 StandardBar::BroadcastClose(pOpDesc); 00391 End(); // End this Op - The above won't do it because m_pOpDesc is NULL 00392 } 00393 } 00394 }
|
|
GetState method.
Definition at line 165 of file stdbars.cpp. 00166 { 00167 // Note this is a STATIC method, else life would be far too easy 00168 OpState state; 00169 00170 // We can only send a message if at least one of our class exists (who knows why) 00171 if (MessageHandler::MessageHandlerExists(CC_RUNTIME_CLASS(StandardBar))) 00172 { 00173 // Send all message handlers of our class a message 00174 // For some reason we have to send it to all DialogOps - apparently we can't broadcast to a subclass 00175 MsgResult m = (BROADCAST_TO_CLASS(StandardBarMsg(pOpDesc, StandardBarMsg::HELLO), DialogOp)); 00176 if (m != OK) state.Ticked=TRUE; 00177 } 00178 return state; 00179 }
|
|
Show the bar (when invoked).
Reimplemented from SimpleCCObject. Definition at line 281 of file stdbars.cpp. 00282 { 00283 00284 // Note we can't use the "String for only one copy" feature because we allow multiple instances 00285 // of this class, provided they are all for different bars (sigh). 00286 #define RegisterStandardBarOpDescriptor(class, name) \ 00287 (RegisterOpDescriptor( \ 00288 0, \ 00289 _R(IDS_BUTTBAR_M_ ## name ), /*NORESOURCEFIX*/ \ 00290 CC_RUNTIME_CLASS(class), \ 00291 _T("IDD_BUTTBAR_") _T(#name), /* Use Dialog ID as Optoken */ /*NORESOURCEFIX*/ \ 00292 class::GetState, /* GetState */ \ 00293 0, /* help ID */ \ 00294 _R(IDBBL_BAR_ ## name), /* Bubble help */ /*NORESOURCEFIX*/ \ 00295 0, /* Resource ID */ \ 00296 _R(IDC_BTN_BAR_ ## name), /* Control ID */ /*NORESOURCEFIX*/ \ 00297 SYSTEMBAR_EDIT, /* Bar ID */ \ 00298 TRUE, /* Recieve system messages */ \ 00299 FALSE, /* Smart duplicate operation*/ \ 00300 TRUE, /* Clean operation */ \ 00301 0, /* No vertical counterpart */ \ 00302 0, /* String for one copy only */ \ 00303 /* _R(IDS_BAR_ ## name ## _ONE), String for one copy only */ /*NORESOURCEFIX*/ \ 00304 0, /* Auto state flags */ \ 00305 TRUE /* Tickable */ \ 00306 )) 00307 00308 return ( 00309 RegisterStandardBarOpDescriptor(StandardBar, GENERAL) && 00310 RegisterStandardBarOpDescriptor(StandardBar, IMAGESETTING) && 00311 RegisterStandardBarOpDescriptor(StandardBar, WINDOW) && 00312 RegisterStandardBarOpDescriptor(StandardBar, ARRANGE) && 00313 RegisterStandardBarOpDescriptor(StandardBar, EDIT) && 00314 RegisterStandardBarOpDescriptor(StandardBar, FILE) && 00315 RegisterStandardBarOpDescriptor(StandardBar, GALLERIES) && 00316 RegisterStandardBarOpDescriptor(StandardBar, STANDARD) && 00317 RegisterStandardBarOpDescriptor(StandardBar, TOOLBAR) && 00318 RegisterStandardBarOpDescriptor(StandardBar, ANIMATION) && 00319 RegisterStandardBarOpDescriptor(StandardBar, FEATHER) && 00320 RegisterStandardBarOpDescriptor(StatusLine, STATUS) && 00321 TRUE); 00322 00323 }
|
|
Reimplemented from DialogOp. Definition at line 152 of file stdbars.h. 00152 {return TRUE;}
|
|
Reimplemented from DialogOp. Definition at line 153 of file stdbars.h. 00153 {return m_Vertical;}
|
|
Standard Message processor.
Reimplemented from DialogOp. Reimplemented in StatusLine. Definition at line 225 of file stdbars.cpp. 00226 { 00227 if (Msg->IsKindOf(CC_RUNTIME_CLASS(StandardBarMsg))) 00228 { 00229 StandardBarMsg * pMsg = ((StandardBarMsg *)(Msg)); 00230 00231 // If we're already got one, EAT the message. Else OK, so pass on. 00232 if (pMsg->m_MsgType == StandardBarMsg::HELLO) 00233 return (pMsg->m_pOpDescriptor == m_pOpDesc)?EAT_MSG:OK; 00234 else if (pMsg->m_MsgType == StandardBarMsg::CLOSE) 00235 { 00236 if (pMsg->m_pOpDescriptor == m_pOpDesc) 00237 { 00238 Close(); // Hide the dialog 00239 m_pOpDesc = NULL; // zap out OpDescriptor pointer 00240 End(); 00241 return OK; 00242 } 00243 } 00244 else 00245 return OK; // who knows what that is all about... 00246 } 00247 00248 DialogMsg* DMsg = (DialogMsg*)Msg; 00249 00250 if (IS_OUR_DIALOG_MSG(Msg)) 00251 { 00252 // Handle ok button 00253 if ((DMsg->DlgMsg == DIM_COMMIT) || (DMsg->DlgMsg == DIM_CANCEL)) 00254 { 00255 Close(); // Hide the dialog 00256 m_pOpDesc = NULL; // zap out OpDescriptor pointer 00257 End(); 00258 return OK; 00259 } 00260 } 00261 00262 return DialogOp::Message(Msg); 00263 }
|
|
|
|
|