mouse and cursor additions for cocoa, see #10361
[wxWidgets.git] / include / wx / osx / core / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/core/private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWidgets itself, it may contain identifiers which don't start
5 // with "wx".
6 // Author: Stefan Csomor
7 // Modified by:
8 // Created: 1998-01-01
9 // RCS-ID: $Id: private.h 53819 2008-05-29 14:11:45Z SC $
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_CORE_H_
15 #define _WX_PRIVATE_CORE_H_
16
17 #include "wx/defs.h"
18
19 #include <CoreFoundation/CoreFoundation.h>
20
21 #include "wx/osx/core/cfstring.h"
22 #include "wx/osx/core/cfdataref.h"
23
24 #if wxOSX_USE_COCOA_OR_CARBON
25
26 WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
27
28 void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to );
29 wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from );
30
31 #endif
32
33 #if wxUSE_GUI
34
35 #if wxOSX_USE_IPHONE
36 #include <CoreGraphics/CoreGraphics.h>
37 #else
38 #include <ApplicationServices/ApplicationServices.h>
39 #endif
40
41 #include "wx/bitmap.h"
42 #include "wx/window.h"
43
44 class WXDLLIMPEXP_CORE wxMacCGContextStateSaver
45 {
46 DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver)
47
48 public:
49 wxMacCGContextStateSaver( CGContextRef cg )
50 {
51 m_cg = cg;
52 CGContextSaveGState( cg );
53 }
54 ~wxMacCGContextStateSaver()
55 {
56 CGContextRestoreGState( m_cg );
57 }
58 private:
59 CGContextRef m_cg;
60 };
61
62 class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject
63 {
64 public :
65 wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj)
66 {
67 }
68 virtual ~wxDeferredObjectDeleter()
69 {
70 delete m_obj;
71 }
72 protected :
73 wxObject* m_obj ;
74 } ;
75
76 // Quartz
77
78 WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
79
80 WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
81 WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
82 WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
83
84 CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
85
86 class wxWindowMac;
87 // to
88 extern wxWindow* g_MacLastWindow;
89 class wxNonOwnedWindow;
90
91 // temporary typedef so that no additional casts are necessary within carbon code at the moment
92
93 class wxMacControl;
94 class wxWidgetImpl;
95 class wxNotebook;
96 class wxTextCtrl;
97
98 #if wxOSX_USE_CARBON
99 typedef wxMacControl wxWidgetImplType;
100 #else
101 typedef wxWidgetImpl wxWidgetImplType;
102 #endif
103
104 class wxMenuItemImpl : public wxObject
105 {
106 public :
107 wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer)
108 {
109 }
110
111 virtual ~wxMenuItemImpl() ;
112 virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
113 virtual void Enable( bool enable ) = 0;
114 virtual void Check( bool check ) = 0;
115 virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0;
116 virtual void Hide( bool hide = true ) = 0;
117
118 virtual void * GetHMenuItem() = 0;
119
120 wxMenuItem* GetWXPeer() { return m_peer ; }
121
122 static wxMenuItemImpl* Create( wxMenuItem* peer, wxMenu *pParentMenu,
123 int id,
124 const wxString& text,
125 wxAcceleratorEntry *entry,
126 const wxString& strHelp,
127 wxItemKind kind,
128 wxMenu *pSubMenu );
129
130 protected :
131 wxMenuItem* m_peer;
132
133 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl);
134 } ;
135
136 class wxMenuImpl : public wxObject
137 {
138 public :
139 wxMenuImpl( wxMenu* peer ) : m_peer(peer)
140 {
141 }
142
143 virtual ~wxMenuImpl() ;
144 virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0;
145 virtual void Remove( wxMenuItem *pItem ) = 0;
146
147 virtual void MakeRoot() = 0;
148
149 virtual void SetTitle( const wxString& text ) = 0;
150
151 virtual WXHMENU GetHMenu() = 0;
152
153 wxMenu* GetWXPeer() { return m_peer ; }
154
155 virtual void PopUp( wxWindow *win, int x, int y ) = 0;
156
157 static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
158 static wxMenuImpl* CreateRootMenu( wxMenu* peer );
159 protected :
160 wxMenu* m_peer;
161
162 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl);
163 } ;
164
165
166
167 class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
168 {
169 public :
170 wxWidgetImpl( wxWindowMac* peer , bool isRootControl = false );
171 wxWidgetImpl();
172 virtual ~wxWidgetImpl();
173
174 void Init();
175
176 bool IsRootControl() const { return m_isRootControl; }
177
178 wxWindowMac* GetWXPeer() const { return m_wxPeer; }
179
180 bool IsOk() const { return GetWXWidget() != NULL; }
181
182 // not only the control itself, but also all its parents must be visible
183 // in order for this function to return true
184 virtual bool IsVisible() const = 0;
185 // set the visibility of this widget (maybe latent)
186 virtual void SetVisibility( bool visible ) = 0;
187
188 virtual void Raise() = 0;
189
190 virtual void Lower() = 0;
191
192 virtual void ScrollRect( const wxRect *rect, int dx, int dy ) = 0;
193
194 virtual WXWidget GetWXWidget() const = 0;
195
196 virtual void SetBackgroundColour( const wxColour& col ) = 0;
197
198 // all coordinates in native parent widget relative coordinates
199 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
200 virtual void Move(int x, int y, int width, int height) = 0;
201 virtual void GetPosition( int &x, int &y ) const = 0;
202 virtual void GetSize( int &width, int &height ) const = 0;
203 virtual void SetControlSize( wxWindowVariant variant ) = 0;
204
205 virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0;
206 virtual bool GetNeedsDisplay() const = 0;
207
208 virtual bool NeedsFocusRect() const;
209 virtual void SetNeedsFocusRect( bool needs );
210
211 virtual bool CanFocus() const = 0;
212 // return true if successful
213 virtual bool SetFocus() = 0;
214 virtual bool HasFocus() const = 0;
215
216 virtual void RemoveFromParent() = 0;
217 virtual void Embed( wxWidgetImpl *parent ) = 0;
218
219 virtual void SetDefaultButton( bool isDefault ) = 0;
220 virtual void PerformClick() = 0;
221 virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0;
222
223 virtual void SetCursor( const wxCursor & cursor ) = 0;
224 virtual void CaptureMouse() = 0;
225 virtual void ReleaseMouse() = 0;
226
227 virtual wxInt32 GetValue() const = 0;
228 virtual void SetValue( wxInt32 v ) = 0;
229 virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
230 virtual void SetupTabs( const wxNotebook &notebook ) =0;
231 virtual void GetBestRect( wxRect *r ) const = 0;
232 virtual bool IsEnabled() const = 0;
233 virtual void Enable( bool enable ) = 0;
234 virtual void SetMinimum( wxInt32 v ) = 0;
235 virtual void SetMaximum( wxInt32 v ) = 0;
236 virtual void PulseGauge() = 0;
237 virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0;
238
239 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0;
240
241 // is the clicked event sent AFTER the state already changed, so no additional
242 // state changing logic is required from the outside
243 virtual bool ButtonClickDidStateChange() = 0;
244
245 virtual void InstallEventHandler( WXWidget control = NULL ) = 0;
246
247 // static methods for associating native controls and their implementations
248
249 static wxWidgetImpl*
250 FindFromWXWidget(WXWidget control);
251
252 static void RemoveAssociations( wxWidgetImpl* impl);
253
254 static void Associate( WXWidget control, wxWidgetImpl *impl );
255
256 // static creation methods, must be implemented by all toolkits
257
258 static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
259 wxWindowMac* parent,
260 wxWindowID id,
261 const wxPoint& pos,
262 const wxSize& size,
263 long style,
264 long extraStyle) ;
265 static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
266
267 static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer,
268 wxWindowMac* parent,
269 wxWindowID id,
270 const wxString& label,
271 const wxPoint& pos,
272 const wxSize& size,
273 long style,
274 long extraStyle) ;
275
276 static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer,
277 wxWindowMac* parent,
278 wxWindowID id,
279 const wxString& label,
280 const wxPoint& pos,
281 const wxSize& size,
282 long style,
283 long extraStyle) ;
284
285 static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
286 wxWindowMac* parent,
287 wxWindowID id,
288 const wxPoint& pos,
289 const wxSize& size,
290 long style,
291 long extraStyle) ;
292
293 static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer,
294 wxWindowMac* parent,
295 wxWindowID id,
296 const wxString& label,
297 const wxPoint& pos,
298 const wxSize& size,
299 long style,
300 long extraStyle) ;
301
302 static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer,
303 wxWindowMac* parent,
304 wxWindowID id,
305 const wxString& label,
306 const wxPoint& pos,
307 const wxSize& size,
308 long style,
309 long extraStyle) ;
310
311 static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
312 wxWindowMac* parent,
313 wxWindowID id,
314 const wxString& content,
315 const wxPoint& pos,
316 const wxSize& size,
317 long style,
318 long extraStyle) ;
319
320 static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer,
321 wxWindowMac* parent,
322 wxWindowID id,
323 const wxString& content,
324 const wxPoint& pos,
325 const wxSize& size,
326 long style,
327 long extraStyle) ;
328
329 static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
330 wxWindowMac* parent,
331 wxWindowID id,
332 const wxString& label,
333 const wxPoint& pos,
334 const wxSize& size,
335 long style,
336 long extraStyle);
337
338 static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
339 wxWindowMac* parent,
340 wxWindowID id,
341 const wxString& label,
342 const wxPoint& pos,
343 const wxSize& size,
344 long style,
345 long extraStyle);
346
347 static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
348 wxWindowMac* parent,
349 wxWindowID id,
350 const wxString& label,
351 const wxPoint& pos,
352 const wxSize& size,
353 long style,
354 long extraStyle);
355
356 static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
357 wxWindowMac* parent,
358 wxWindowID id,
359 const wxBitmap& bitmap,
360 const wxPoint& pos,
361 const wxSize& size,
362 long style,
363 long extraStyle);
364
365 static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
366 wxWindowMac* parent,
367 wxWindowID id,
368 const wxBitmap& bitmap,
369 const wxPoint& pos,
370 const wxSize& size,
371 long style,
372 long extraStyle);
373
374 static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
375 wxWindowMac* parent,
376 wxWindowID id,
377 const wxPoint& pos,
378 const wxSize& size,
379 long style,
380 long extraStyle);
381
382 static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
383 wxWindowMac* parent,
384 wxWindowID id,
385 wxInt32 value,
386 wxInt32 minimum,
387 wxInt32 maximum,
388 const wxPoint& pos,
389 const wxSize& size,
390 long style,
391 long extraStyle);
392
393 static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
394 wxWindowMac* parent,
395 wxWindowID id,
396 wxInt32 value,
397 wxInt32 minimum,
398 wxInt32 maximum,
399 const wxPoint& pos,
400 const wxSize& size,
401 long style,
402 long extraStyle);
403
404 static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
405 wxWindowMac* parent,
406 wxWindowID id,
407 wxInt32 value,
408 wxInt32 minimum,
409 wxInt32 maximum,
410 const wxPoint& pos,
411 const wxSize& size,
412 long style,
413 long extraStyle);
414
415 static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
416 wxWindowMac* parent,
417 wxWindowID id,
418 const wxPoint& pos,
419 const wxSize& size,
420 long style,
421 long extraStyle);
422
423 static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
424 wxWindowMac* parent,
425 wxWindowID id,
426 wxMenu* menu,
427 const wxPoint& pos,
428 const wxSize& size,
429 long style,
430 long extraStyle);
431
432 static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
433 wxWindowMac* parent,
434 wxWindowID id,
435 const wxPoint& pos,
436 const wxSize& size,
437 long style,
438 long extraStyle);
439
440 // converts from Toplevel-Content relative to local
441 static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
442 protected :
443 bool m_isRootControl;
444 wxWindowMac* m_wxPeer;
445 bool m_needsFocusRect;
446
447 DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
448 };
449
450 //
451 // the interface to be implemented eg by a listbox
452 //
453
454 class WXDLLIMPEXP_CORE wxListWidgetColumn
455 {
456 public :
457 virtual ~wxListWidgetColumn() {}
458 } ;
459
460 class WXDLLIMPEXP_CORE wxListWidgetCellValue
461 {
462 public :
463 wxListWidgetCellValue() {}
464 virtual ~wxListWidgetCellValue() {}
465
466 virtual void Set( CFStringRef value ) = 0;
467 virtual void Set( const wxString& value ) = 0;
468 virtual void Set( int value ) = 0;
469
470 virtual int GetIntValue() const = 0;
471 virtual wxString GetStringValue() const = 0;
472 } ;
473
474 class WXDLLIMPEXP_CORE wxListWidgetImpl
475 {
476 public:
477 wxListWidgetImpl() {}
478 virtual ~wxListWidgetImpl() { }
479
480 virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
481 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
482 virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
483 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
484
485 // add and remove
486
487 // TODO will be replaced
488 virtual void ListDelete( unsigned int n ) = 0;
489 virtual void ListInsert( unsigned int n ) = 0;
490 virtual void ListClear() = 0;
491
492 // selecting
493
494 virtual void ListDeselectAll() = 0;
495 virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0;
496 virtual int ListGetSelection() const = 0;
497 virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0;
498 virtual bool ListIsSelected( unsigned int n ) const = 0;
499
500 // display
501
502 virtual void ListScrollTo( unsigned int n ) = 0;
503 virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0;
504 virtual void UpdateLineToEnd( unsigned int n) = 0;
505
506 // accessing content
507
508 virtual unsigned int ListGetCount() const = 0;
509 };
510
511 //
512 // interface to be implemented by a textcontrol
513 //
514
515 class WXDLLIMPEXP_FWD_CORE wxTextAttr;
516
517 // common interface for all implementations
518 class WXDLLIMPEXP_CORE wxTextWidgetImpl
519
520 {
521 public :
522 wxTextWidgetImpl() {}
523
524 virtual ~wxTextWidgetImpl() {}
525
526 virtual bool CanFocus() const { return true; }
527
528 virtual wxString GetStringValue() const = 0 ;
529 virtual void SetStringValue( const wxString &val ) = 0 ;
530 virtual void SetSelection( long from, long to ) = 0 ;
531 virtual void GetSelection( long* from, long* to ) const = 0 ;
532 virtual void WriteText( const wxString& str ) = 0 ;
533
534 virtual void SetStyle( long start, long end, const wxTextAttr& style ) ;
535 virtual void Copy() ;
536 virtual void Cut() ;
537 virtual void Paste() ;
538 virtual bool CanPaste() const ;
539 virtual void SetEditable( bool editable ) ;
540 virtual long GetLastPosition() const ;
541 virtual void Replace( long from, long to, const wxString &str ) ;
542 virtual void Remove( long from, long to ) ;
543
544
545 virtual bool HasOwnContextMenu() const
546 { return false ; }
547
548 virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) )
549 { return false ; }
550
551 virtual void Clear() ;
552 virtual bool CanUndo() const;
553 virtual void Undo() ;
554 virtual bool CanRedo() const;
555 virtual void Redo() ;
556 virtual int GetNumberOfLines() const ;
557 virtual long XYToPosition(long x, long y) const;
558 virtual bool PositionToXY(long pos, long *x, long *y) const ;
559 virtual void ShowPosition(long WXUNUSED(pos)) ;
560 virtual int GetLineLength(long lineNo) const ;
561 virtual wxString GetLineText(long lineNo) const ;
562 virtual void CheckSpelling(bool WXUNUSED(check)) { }
563 };
564
565 //
566 // common interface for search controls
567 //
568
569 class wxSearchWidgetImpl
570 {
571 public :
572 wxSearchWidgetImpl(){}
573 virtual ~wxSearchWidgetImpl(){}
574
575 // search field options
576 virtual void ShowSearchButton( bool show ) = 0;
577 virtual bool IsSearchButtonVisible() const = 0;
578
579 virtual void ShowCancelButton( bool show ) = 0;
580 virtual bool IsCancelButtonVisible() const = 0;
581
582 virtual void SetSearchMenu( wxMenu* menu ) = 0;
583
584 virtual void SetDescriptiveText(const wxString& text) = 0;
585 } ;
586
587 //
588 // toplevel window implementation class
589 //
590
591 class wxNonOwnedWindowImpl : public wxObject
592 {
593 public :
594 wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd)
595 {
596 }
597 wxNonOwnedWindowImpl()
598 {
599 }
600 virtual ~wxNonOwnedWindowImpl()
601 {
602 }
603
604 virtual void Destroy()
605 {
606 }
607
608 virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
609 long style, long extraStyle, const wxString& name ) = 0;
610
611
612 virtual WXWindow GetWXWindow() const = 0;
613
614 virtual void Raise()
615 {
616 }
617
618 virtual void Lower()
619 {
620 }
621
622 virtual bool Show(bool WXUNUSED(show))
623 {
624 return false;
625 }
626
627 virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
628 {
629 return Show(show);
630 }
631
632 virtual void Update()
633 {
634 }
635
636 virtual bool SetTransparent(wxByte WXUNUSED(alpha))
637 {
638 return false;
639 }
640
641 virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) )
642 {
643 return false;
644 }
645
646 virtual void SetExtraStyle( long WXUNUSED(exStyle) )
647 {
648 }
649
650 virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
651 {
652 return false ;
653 }
654
655 bool CanSetTransparent()
656 {
657 return false;
658 }
659
660 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
661 virtual void MoveWindow(int x, int y, int width, int height) = 0;
662 virtual void GetPosition( int &x, int &y ) const = 0;
663 virtual void GetSize( int &width, int &height ) const = 0;
664
665 virtual bool SetShape(const wxRegion& WXUNUSED(region))
666 {
667 return false;
668 }
669
670 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
671
672 virtual bool IsMaximized() const = 0;
673
674 virtual bool IsIconized() const= 0;
675
676 virtual void Iconize( bool iconize )= 0;
677
678 virtual void Maximize(bool maximize) = 0;
679
680 virtual bool IsFullScreen() const= 0;
681
682 virtual bool ShowFullScreen(bool show, long style)= 0;
683
684 virtual void RequestUserAttention(int flags) = 0;
685
686 virtual void ScreenToWindow( int *x, int *y ) = 0;
687
688 virtual void WindowToScreen( int *x, int *y ) = 0;
689
690 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
691
692 // static creation methods, must be implemented by all toolkits
693
694 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
695 long style, long extraStyle, const wxString& name ) ;
696
697 protected :
698 wxNonOwnedWindow* m_wxPeer;
699 DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
700 };
701
702 #endif // wxUSE_GUI
703
704 //---------------------------------------------------------------------------
705 // cocoa bridging utilities
706 //---------------------------------------------------------------------------
707
708 bool wxMacInitCocoa();
709
710 class WXDLLIMPEXP_CORE wxMacAutoreleasePool
711 {
712 public :
713 wxMacAutoreleasePool();
714 ~wxMacAutoreleasePool();
715 private :
716 void* m_pool;
717 };
718
719 // NSObject
720
721 void wxMacCocoaRelease( void* obj );
722 void wxMacCocoaAutorelease( void* obj );
723 void wxMacCocoaRetain( void* obj );
724
725
726 #endif
727 // _WX_PRIVATE_CORE_H_