00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_BASEBAR
00101 #define INC_BASEBAR
00102
00103
00104
00105
00106
00107 #ifndef WIN32
00108 #include "dlgmgr.h"
00109 #endif
00110
00111
00112 class Cursor;
00113
00114 #define TITLE_BAR_HEIGHT 10
00115 #define BAR_BORDERSIZE 4
00116 #define BAR_VERTICAL_CENTEROFFSET 2
00117 #define BAR_HORIZONTAL_CENTEROFFSET 3
00118
00119 #define DO_TIDY TRUE
00120 #define DONT_TIDY FALSE
00121
00122 #define CHANGE_MARGIN 4
00123
00124 #define INFOBAR_WIDTH 600
00125
00126 #define DRAG_START_MARGIN 1
00127
00128
00129 #define VERTICAL_SPACE 2
00130
00131 enum DDeckerControlHeights { SMALL_DDECKERS = 13, LARGE_DDECKERS = 16 };
00132
00133
00134 enum BaseBarMode {DIALOG, BAR};
00135
00136
00137 enum DlgDragType { NONE = 0, MOVE, GROW_NORTH, GROW_SOUTH, GROW_EAST, GROW_WEST,
00138 GROW_SOUTHEAST,GROW_NORTHEAST,GROW_SOUTHWEST,GROW_NORTHWEST, TRYING };
00139
00140
00141 enum NearestEdge { LEFT,RIGHT,TOP,BOTTOM,NOEDGE };
00142
00143 enum SeparatorWidths { SMALL_SEPARATOR = 6,LARGE_SEPARATOR = 10};
00144
00145
00146 enum ForceControlSize { USE_BAR,FORCE_SMALL,FORCE_LARGE};
00147
00148 enum DDeckerReadState {DDECKER_NONE,DDECKER_TOP,DDECKER_BOTTOM};
00149
00150 enum ControlDragMode{CUT,COPY};
00151
00152 enum ControlDragState{READY,DRAGGING,NO_DRAG};
00153
00154 typedef enum
00155 {
00156 BUTTON,
00157 BITMAPBUTTON,
00158 SMALLBITMAPBUTTON,
00159 STATICBITMAP,
00160 DECKER_TOP,
00161 DECKER_BOTTOM,
00162 DECKER_END,
00163 SEPARATOR,
00164 LINEFEED,
00165 COMBO,
00166 EDIT,
00167 LIST,
00168 STATIC,
00169 SCROLLBAR,
00170 TEXT3D,
00171 ROTATEGRID,
00172 OTHERCONTROL,
00173 SLIDER,
00174 BITMAPCOMBO1D,
00175 BITMAPCOMBO2D,
00176 UNKNOWN_ITEM
00177 } BarItemType;
00178
00179 BarItemType GetEnumItemType(BarItem * Item);
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 class FormatPosition : public ListItem
00192 {
00193 CC_DECLARE_DYNAMIC( FormatPosition )
00194
00195 public:
00196 INT32 Height;
00197 INT32 Width;
00198
00199 FormatPosition()
00200 {
00201 Height=0;
00202 Width=0;
00203 };
00204
00205 FormatPosition(INT32 w,INT32 h)
00206 {
00207 Height =h;
00208 Width =w;
00209 };
00210
00211
00212 };
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 class BaseBar : public wxWindow
00228 {
00229 public:
00230
00231 BaseBar();
00232 virtual ~BaseBar();
00233
00234 static BOOL DeclarePreferences();
00235 static BOOL PlotStretchedMaskedBitmap(wxDC* destDC, wxBitmap* srcBitmap, wxRect Pos);
00236 static BOOL HaveNonClientMetricsChanged();
00237
00238 INT32 Create(DialogBarOp* Op);
00239 BOOL Hide(DialogBarOp* Op);
00240 BOOL Show(DialogBarOp* Op);
00241
00242
00243 BOOL Recreate(DockBarType DockBarTyp, BaseBar* BaseBar, DialogBarOp* Op,BOOL CanCopy );
00244 BOOL RecreateAt(KernelBarPos Pos,DockBarType DockBarTyp,
00245 BaseBar* BaseBar, DialogBarOp* Op, wxWindow* OldHwnd );
00246
00247 static BOOL IsDoingErrorBox();
00248 static void StartErrorBox();
00249 static void FinishErrorBox();
00250
00251 static BOOL IsBarInRecreate();
00252 static BOOL GetStatusLineText(String_256 * StatusText);
00253
00254 static BOOL HasGalleryGotFocus(){return GalleryHasFocus;};
00255
00256 static BOOL AltPressed(BOOL state);
00257 static BOOL CtlPressed(BOOL state);
00258 static BOOL EscPressed(BOOL state);
00259 static BOOL CancelAllDrags();
00260 static void ClearFocusFlags(){ControlHasFocus = FALSE;HwndWithFocus =(wxWindow*)0;};
00261
00262 void ConvertToolbarOnStartup ();
00263 static BaseBar* GetPtrToToolBar () { return (PtrToToolBar); }
00264 BOOL FormatToolBar (INT32 NewWidth);
00265 DialogBarOp* GetDialogBarOp () { return (pOp); }
00266 wxRect GetBarsDims (DockBarType DockBarType);
00267
00268 BOOL TidyUpControlDrag();
00269 BOOL TidyUpBarDrag();
00270
00271 UINT32 GetNearestControl(wxPoint DropPoint);
00272 BOOL IsBarActive(){return Active;};
00273 BOOL IsInfoBar(){ return ThisIsAnInfoBar ;} ;
00274 BOOL IsBarAllCtlBar(){return pOp->IsAllBarsOp(); };
00275
00276 void SetBarActiveState(BOOL State){ Active = State;};
00277
00278
00279 virtual wxRect GetFormatRect(DockBarType BarType);
00280
00281 void InitFormatRects();
00282
00283 String_32 GetBarName(){return pOp->GetName();};
00284
00285 LRESULT WindowProc( UINT32 message, WPARAM wParam, LPARAM lParam );
00286
00287 DECLARE_DYNAMIC_CLASS( BaseBar )
00288 DECLARE_EVENT_TABLE()
00289
00290 protected:
00291
00292
00293
00294
00295
00296 BOOL EndControlDrag(wxPoint point);
00297 BOOL DropControl(wxPoint point,wxWindow* OverBar,BOOL InsertSeparator);
00298 void CacheAllDockRects();
00299
00300 void Paint3dPlinth(wxDC* pDC, wxRect *rect, BOOL PlinthOut);
00301
00302
00303 virtual DockBarType BarCloseToDock(wxPoint CursorPos);
00304
00305
00306 virtual void SetFormatVariables();
00307
00308
00309 virtual void PaintDialogNonClient(BOOL Active);
00310
00311 virtual void PaintWin95DialogNonClient(BOOL IsActive);
00312
00313 virtual void PaintChicagoBorder();
00314
00315
00316 void PaintXORDragRect(wxRect Rect, DockBarType DockBar);
00317
00318 void PaintDragRect(wxRect Rect,wxRect OldRect,DockBarType DockBar,DockBarType OldBarType);
00319
00320
00321 virtual void StartDrag(wxPoint point, DlgDragType TypeOfDrag);
00322
00323
00324 virtual BOOL CanStartDrag(wxPoint point);
00325
00326 virtual DockBarType IsPointerOverDock(wxPoint point);
00327
00328
00329 void CloseCombos();
00330
00331 virtual wxRect GetDragFormatRect(DockBarType BarType, wxPoint CursorPos, BOOL ToLeft, BOOL Below);
00332
00333
00334 virtual wxPoint CalcDragOffset(wxRect DragRect, wxPoint CursorPos, BOOL ToLeft, BOOL Below);
00335 virtual void CalcDragOffsetDirection(DockBarType BarType, wxPoint CursorPos);
00336
00337 BOOL SimpleIntersect( const wxRect &rect1, const wxRect &rrect2 );
00338
00339
00340
00341
00342 virtual wxRect GetDlgBarRect(DockBarType DockBar, wxRect CurrentBarRect);
00343
00344
00345 void InformControlsDead();
00346
00347
00348 BOOL CopyOrLoadControls(wxWindow* BarHwnd);
00349
00350
00351 BOOL LoadResourceControls();
00352
00353
00354 BOOL CreateToolBtn(BarToolButton* pToolBtn);
00355
00356
00357 virtual BOOL PositionControls(BOOL DoRedraw = TRUE);
00358
00359 HINSTANCE GetModuleInst(const BarControlInfo*pBarCtlInfo,UINT32 * ToolModuleID );
00360
00361 DLGITEMTEMPLATE* GetPointerToControl(DLGTEMPLATE* pDlg ,UINT32 CtlId);
00362
00363
00364
00365 BOOL CreateControlFromResource(BarControl* pBarItem);
00366
00367 BOOL CreateInfoControlFromResource(BarControl* pBarItem,BOOL Init);
00368
00369
00370 BOOL CreateControlItem(DLGITEMTEMPLATE * pCurrentControl,
00371 BarControl* pBarItem,
00372 HINSTANCE ModuleInst,
00373 UINT32 ToolModuleID);
00374
00375
00376 virtual BOOL FormatBar(BOOL MoveWindows,ForceControlSize Force);
00377
00378
00379 virtual BOOL FormatFloatingBar(BOOL MoveWindows,ForceControlSize Force);
00380
00381
00382 virtual BOOL FormatHorizontalBar(BOOL MoveWindows,ForceControlSize Force);
00383
00384
00385 virtual BOOL FormatVerticalBar(BOOL MoveWindows,ForceControlSize Force);
00386
00387
00388
00389 BOOL TidyBarItemsAfterDrag();
00390
00391
00392 BOOL FormatLineFeeds(INT32 Targetx,wxSize * pBarSize = NULL,INT32 * pNoLfs = NULL);
00393
00394
00395 KernelBarPos * GetBarPosition();
00396
00397
00398 DockBarType GetDockBarType();
00399
00400
00401 BOOL HasOrientationChanged(DockBarType Old,DockBarType New);
00402
00403
00404 static BOOL SwapCursors(DWORD CursorID);
00405
00406
00407 virtual wxRect SetBarSize(DockBarType BarType,BOOL DoRedraw = TRUE);
00408
00409
00410 virtual void AdjustFormattedBarSize(wxSize* BarSize);
00411
00412
00413 virtual INT32 CreateExtraControls();
00414
00415
00416 virtual void PositionExtraControls(wxSize BarSize, INT32 xpos, INT32 ypos);
00417
00418
00419 BOOL CacheFormatingData();
00420 BOOL GetBestCachedWidth(INT32 TargetHeight, INT32 * FoundWidth);
00421
00422
00423 virtual BOOL SetStatusLineText();
00424
00425
00426 virtual BOOL GetStatusText(String_256 * StatusTextBuf);
00427
00428
00429 LPWSTR MovePastWideStr(LPWSTR pWideStr);
00430 size_t SizeDlgHeader(DLGTEMPLATE *pHeader);
00431 size_t SizeCtrlData(DLGITEMTEMPLATE *pControl);
00432
00433
00434
00435
00436
00437 static BaseBar * CurrentBar;
00438
00439
00440 DialogBarOp* pOp;
00441
00442
00443 DockBarType ParentDockBarType;
00444
00445
00446 DockBarType DragDockBarType;
00447
00448
00449 DockBarType OldDragBarType;
00450
00451 DockBarType LastFixedDragType;
00452
00453
00454 OILDockingBar* ParentDockBar;
00455
00456
00457 wxPaintDC *PaintDC;
00458
00459
00460 wxBitmap BrushBitmap ;
00461
00462
00463 BaseBarMode CurrentDlgBarMode;
00464
00465 wxRect ScreenRect;
00466
00467
00468 wxRect TopRect;
00469 wxRect LeftRect;
00470 wxRect RightRect;
00471 wxRect BottomRect;
00472
00473
00474
00475 static Cursor* pCurrentCursor;
00476 static Cursor* pButtonCopyCursor;
00477 static Cursor* pButtonCutCursor;
00478 static INT32 CurrentCursorID;
00479 static INT32 BorderWidth ;
00480 static INT32 TitleBarHeight ;
00481
00482
00483
00484
00485
00486
00487 wxRect SysMenuRect;
00488 wxRect TopBorderRect;
00489 wxRect BottomBorderRect;
00490 wxRect LeftBorderRect;
00491 wxRect RightBorderRect;
00492 wxRect CaptionBarRect;
00493 wxRect TopLeftGrowRect;
00494 wxRect BottomLeftGrowRect;
00495 wxRect TopRightGrowRect;
00496 wxRect BottomRightGrowRect;
00497
00498
00499
00500 SeparatorWidths SeparatorWidth;
00501
00503
00504
00505
00506 INT32 HeightEstimate;
00507
00508
00509 double WidestFloat;
00510 double TallestFloat;
00511
00512
00513 List FormatPositions ;
00514
00515 wxRect DragStartRect;
00516
00517 static DlgDragType DragType;
00518
00519 static BOOL InRecreate;
00520
00521 static BOOL DoingErrorBox;
00522
00523 static BOOL ControlHasFocus;
00524
00525 static wxWindow* HwndWithFocus ;
00526
00527 static BOOL GalleryHasFocus ;
00528
00529
00530 static UINT32 GalButtonWidth;
00531
00532
00533
00534 static BOOL IsBackGroundRendering;
00535
00536 BOOL ListBoxHasFocus;
00537
00538
00539 wxPoint StartDragPoint ;
00540
00541
00542 wxPoint DragOffset;
00543 BOOL DragOffsetFromTop;
00544 BOOL DragOffsetFromLeft;
00545
00546 KernelBarPos LastSmallBarPos;
00547
00548
00549 wxPoint BorderOffset;
00550
00551 static wxRect OldDragRect;
00552
00553
00554 wxRect FloatSmallRect;
00555 wxRect HorizontalSmallRect;
00556 wxRect VerticalSmallRect;
00557 wxRect FloatLargeRect;
00558 wxRect HorizontalLargeRect;
00559 wxRect VerticalLargeRect;
00560
00561 PORTNOTE("other", "removed fonts from bars")
00562 #ifndef EXCLUDE_FROM_XARALX
00563
00564 wxFont * TitleFont;
00565
00566
00567 wxFont * BarFont;
00568
00569
00570 wxFont * SmallThinFont;
00571 wxFont * LargeThinFont;
00572 #endif
00573
00574
00575 BOOL ThisIsAnInfoBar ;
00576
00577
00578
00579 BOOL Active;
00580
00581 static wxWindow * LastWindowWithFocus;
00582
00583
00584
00585
00586 wxDC* pDisplayDC;
00587 INT32 OldDrawMode;
00588 wxBrush * pOldBrush;
00589 wxBrush * pDragBrush;
00590
00591
00592
00593 DDeckerReadState DDeckerState;
00594
00595 DDeckerReadState IsDoubleDecker(BarItem * ThisControl,BarItem * Start,BarItem * End);
00596
00597
00598
00599 static wxRect LastCtlDragRect;
00600 wxRect DragCtlClientRect;
00601 wxWindow* DragCtlHwnd;
00602 BOOL IsDraggingControl;
00603 wxPoint DragCtlOffset;
00604 static ControlDragMode CtlDragMode;
00605 static ControlDragState CtlDragState;
00606
00607 static BaseBar* PtrToToolBar;
00608
00609 public:
00610
00611
00612 static BOOL IsDragging() { return DragType != 0; }
00613 };
00614
00615 #endif
00616