1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/tbargtk.cpp
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
5 // Modified: 13.12.99 by VZ to derive from wxToolBarBase
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
14 #if wxUSE_TOOLBAR_NATIVE
16 #include "wx/toolbar.h"
18 #include "wx/gtk/private.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
25 extern bool g_blockEventsOnDrag
;
26 extern wxCursor g_globalCursor
;
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 class wxToolBarTool
: public wxToolBarToolBase
35 wxToolBarTool(wxToolBar
*tbar
,
37 const wxString
& label
,
38 const wxBitmap
& bitmap1
,
39 const wxBitmap
& bitmap2
,
42 const wxString
& shortHelpString
,
43 const wxString
& longHelpString
)
44 : wxToolBarToolBase(tbar
, id
, label
, bitmap1
, bitmap2
, kind
,
45 clientData
, shortHelpString
, longHelpString
)
50 wxToolBarTool(wxToolBar
*tbar
, wxControl
*control
, const wxString
& label
)
51 : wxToolBarToolBase(tbar
, control
, label
)
57 void CreateDropDown();
58 void ShowDropdown(GtkToggleButton
* button
);
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxControl
)
69 // ============================================================================
71 // ============================================================================
73 //-----------------------------------------------------------------------------
74 // "clicked" from m_item
75 //-----------------------------------------------------------------------------
78 static void item_clicked(GtkToolButton
*, wxToolBarTool
* tool
)
80 if (g_blockEventsOnDrag
) return;
82 tool
->GetToolBar()->OnLeftClick(tool
->GetId(), false);
86 //-----------------------------------------------------------------------------
87 // "toggled" from m_item
88 //-----------------------------------------------------------------------------
91 static void item_toggled(GtkToggleToolButton
* button
, wxToolBarTool
* tool
)
93 if (g_blockEventsOnDrag
) return;
95 const bool active
= gtk_toggle_tool_button_get_active(button
) != 0;
97 if (!active
&& tool
->GetKind() == wxITEM_RADIO
)
100 if (!tool
->GetToolBar()->OnLeftClick(tool
->GetId(), active
))
108 //-----------------------------------------------------------------------------
109 // "button_press_event" from m_item child
110 //-----------------------------------------------------------------------------
114 button_press_event(GtkWidget
*, GdkEventButton
* event
, wxToolBarTool
* tool
)
116 if (event
->button
!= 3)
119 if (g_blockEventsOnDrag
) return TRUE
;
121 tool
->GetToolBar()->OnRightClick(
122 tool
->GetId(), int(event
->x
), int(event
->y
));
128 //-----------------------------------------------------------------------------
129 // "child_detached" from m_widget
130 //-----------------------------------------------------------------------------
133 static void child_detached(GtkWidget
*, GtkToolbar
* toolbar
, void*)
135 // disable showing overflow arrow when toolbar is detached,
136 // otherwise toolbar collapses to just an arrow
137 gtk_toolbar_set_show_arrow(toolbar
, false);
141 //-----------------------------------------------------------------------------
142 // "child_attached" from m_widget
143 //-----------------------------------------------------------------------------
146 static void child_attached(GtkWidget
*, GtkToolbar
* toolbar
, void*)
148 gtk_toolbar_set_show_arrow(toolbar
, true);
152 //-----------------------------------------------------------------------------
153 // "enter_notify_event" / "leave_notify_event" from m_item
154 //-----------------------------------------------------------------------------
158 enter_notify_event(GtkWidget
*, GdkEventCrossing
* event
, wxToolBarTool
* tool
)
160 if (g_blockEventsOnDrag
) return TRUE
;
163 if (event
->type
== GDK_ENTER_NOTIFY
)
165 tool
->GetToolBar()->OnMouseEnter(id
);
171 //-----------------------------------------------------------------------------
172 // "size_request" from m_toolbar
173 //-----------------------------------------------------------------------------
177 size_request(GtkWidget
*, GtkRequisition
* req
, wxToolBar
* win
)
179 const wxSize margins
= win
->GetMargins();
180 req
->width
+= margins
.x
;
181 req
->height
+= 2 * margins
.y
;
185 //-----------------------------------------------------------------------------
186 // "expose_event" from GtkImage inside m_item
187 //-----------------------------------------------------------------------------
191 image_expose_event(GtkWidget
* widget
, GdkEventExpose
*, wxToolBarTool
* tool
)
193 const wxBitmap
& bitmap
= tool
->GetDisabledBitmap();
194 if (tool
->IsEnabled() || !bitmap
.IsOk())
197 // draw disabled bitmap ourselves, GtkImage has no way to specify it
198 const GtkAllocation
& alloc
= widget
->allocation
;
200 widget
->window
, widget
->style
->black_gc
, bitmap
.GetPixbuf(),
202 alloc
.x
+ (alloc
.width
- widget
->requisition
.width
) / 2,
203 alloc
.y
+ (alloc
.height
- widget
->requisition
.height
) / 2,
204 -1, -1, GDK_RGB_DITHER_NORMAL
, 0, 0);
209 //-----------------------------------------------------------------------------
210 // "toggled" from dropdown menu button
211 //-----------------------------------------------------------------------------
214 static void arrow_toggled(GtkToggleButton
* button
, wxToolBarTool
* tool
)
216 if (gtk_toggle_button_get_active(button
))
218 tool
->ShowDropdown(button
);
219 gtk_toggle_button_set_active(button
, false);
224 //-----------------------------------------------------------------------------
225 // "button_press_event" from dropdown menu button
226 //-----------------------------------------------------------------------------
230 arrow_button_press_event(GtkToggleButton
* button
, GdkEventButton
* event
, wxToolBarTool
* tool
)
232 if (event
->button
== 1)
234 g_signal_handlers_block_by_func(button
, (void*)arrow_toggled
, tool
);
235 gtk_toggle_button_set_active(button
, true);
236 tool
->ShowDropdown(button
);
237 gtk_toggle_button_set_active(button
, false);
238 g_signal_handlers_unblock_by_func(button
, (void*)arrow_toggled
, tool
);
245 //-----------------------------------------------------------------------------
246 // InsertChild callback for wxToolBar
247 //-----------------------------------------------------------------------------
249 static void wxInsertChildInToolBar(wxWindow
* parent
, wxWindow
* child
)
251 GtkWidget
* align
= gtk_alignment_new(0.5, 0.5, 0, 0);
252 gtk_widget_show(align
);
253 gtk_container_add(GTK_CONTAINER(align
), child
->m_widget
);
254 GtkToolItem
* item
= gtk_tool_item_new();
255 gtk_container_add(GTK_CONTAINER(item
), align
);
256 wxToolBar
* tbar
= static_cast<wxToolBar
*>(parent
);
257 // position will be corrected in DoInsertTool if necessary
258 gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(tbar
->m_widget
)->child
), item
, -1);
261 // ----------------------------------------------------------------------------
263 // ----------------------------------------------------------------------------
265 void wxToolBarTool::SetImage()
267 const wxBitmap
& bitmap
= GetNormalBitmap();
268 wxCHECK_RET(bitmap
.IsOk(), "invalid bitmap for wxToolBar icon");
270 GtkWidget
* image
= gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item
));
271 // always use pixbuf, because pixmap mask does not
272 // work with disabled images in some themes
273 gtk_image_set_from_pixbuf(GTK_IMAGE(image
), bitmap
.GetPixbuf());
276 // helper to create a dropdown menu item
277 void wxToolBarTool::CreateDropDown()
279 gtk_tool_item_set_homogeneous(m_item
, false);
282 if (GetToolBar()->HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
284 box
= gtk_vbox_new(false, 0);
285 arrow
= gtk_arrow_new(GTK_ARROW_RIGHT
, GTK_SHADOW_NONE
);
289 box
= gtk_hbox_new(false, 0);
290 arrow
= gtk_arrow_new(GTK_ARROW_DOWN
, GTK_SHADOW_NONE
);
292 GtkWidget
* tool_button
= GTK_BIN(m_item
)->child
;
293 gtk_widget_reparent(tool_button
, box
);
294 GtkWidget
* arrow_button
= gtk_toggle_button_new();
295 gtk_button_set_relief(GTK_BUTTON(arrow_button
),
296 gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item
)));
297 gtk_container_add(GTK_CONTAINER(arrow_button
), arrow
);
298 gtk_container_add(GTK_CONTAINER(box
), arrow_button
);
299 gtk_widget_show_all(box
);
300 gtk_container_add(GTK_CONTAINER(m_item
), box
);
302 g_signal_connect(arrow_button
, "toggled", G_CALLBACK(arrow_toggled
), this);
303 g_signal_connect(arrow_button
, "button_press_event",
304 G_CALLBACK(arrow_button_press_event
), this);
307 void wxToolBarTool::ShowDropdown(GtkToggleButton
* button
)
309 wxToolBarBase
* toolbar
= GetToolBar();
310 wxCommandEvent
event(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED
, GetId());
311 if (!toolbar
->HandleWindowEvent(event
))
313 wxMenu
* menu
= GetDropdownMenu();
316 const GtkAllocation
& alloc
= GTK_WIDGET(button
)->allocation
;
319 if (toolbar
->HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
323 toolbar
->PopupMenu(menu
, x
, y
);
328 wxToolBarToolBase
*wxToolBar::CreateTool(int id
,
329 const wxString
& text
,
330 const wxBitmap
& bitmap1
,
331 const wxBitmap
& bitmap2
,
333 wxObject
*clientData
,
334 const wxString
& shortHelpString
,
335 const wxString
& longHelpString
)
337 return new wxToolBarTool(this, id
, text
, bitmap1
, bitmap2
, kind
,
338 clientData
, shortHelpString
, longHelpString
);
342 wxToolBar::CreateTool(wxControl
*control
, const wxString
& label
)
344 return new wxToolBarTool(this, control
, label
);
347 //-----------------------------------------------------------------------------
348 // wxToolBar construction
349 //-----------------------------------------------------------------------------
351 void wxToolBar::Init()
353 m_toolbar
= (GtkToolbar
*)NULL
;
357 wxToolBar::~wxToolBar()
361 gtk_object_destroy(GTK_OBJECT(m_tooltips
));
362 g_object_unref(m_tooltips
);
366 bool wxToolBar::Create( wxWindow
*parent
,
371 const wxString
& name
)
373 m_insertCallback
= wxInsertChildInToolBar
;
375 if ( !PreCreation( parent
, pos
, size
) ||
376 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
378 wxFAIL_MSG( wxT("wxToolBar creation failed") );
385 m_toolbar
= GTK_TOOLBAR( gtk_toolbar_new() );
386 m_tooltips
= gtk_tooltips_new();
387 g_object_ref(m_tooltips
);
388 gtk_object_sink(GTK_OBJECT(m_tooltips
));
391 if (style
& wxTB_DOCKABLE
)
393 m_widget
= gtk_handle_box_new();
395 g_signal_connect(m_widget
, "child_detached",
396 G_CALLBACK(child_detached
), NULL
);
397 g_signal_connect(m_widget
, "child_attached",
398 G_CALLBACK(child_attached
), NULL
);
400 if (style
& wxTB_FLAT
)
401 gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget
), GTK_SHADOW_NONE
);
405 m_widget
= gtk_event_box_new();
406 ConnectWidget( m_widget
);
408 g_object_ref(m_widget
);
409 gtk_container_add(GTK_CONTAINER(m_widget
), GTK_WIDGET(m_toolbar
));
410 gtk_widget_show(GTK_WIDGET(m_toolbar
));
412 m_parent
->DoAddChild( this );
416 g_signal_connect_after(m_toolbar
, "size_request",
417 G_CALLBACK(size_request
), this);
422 GdkWindow
*wxToolBar::GTKGetWindow(wxArrayGdkWindows
& WXUNUSED(windows
)) const
424 return GTK_WIDGET(m_toolbar
)->window
;
427 void wxToolBar::GtkSetStyle()
429 GtkOrientation orient
= GTK_ORIENTATION_HORIZONTAL
;
430 if (HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
431 orient
= GTK_ORIENTATION_VERTICAL
;
433 GtkToolbarStyle style
= GTK_TOOLBAR_ICONS
;
434 if (HasFlag(wxTB_NOICONS
))
435 style
= GTK_TOOLBAR_TEXT
;
436 else if (HasFlag(wxTB_TEXT
))
438 style
= GTK_TOOLBAR_BOTH
;
439 if (HasFlag(wxTB_HORZ_LAYOUT
))
440 style
= GTK_TOOLBAR_BOTH_HORIZ
;
443 gtk_toolbar_set_orientation(m_toolbar
, orient
);
444 gtk_toolbar_set_style(m_toolbar
, style
);
447 void wxToolBar::SetWindowStyleFlag( long style
)
449 wxToolBarBase::SetWindowStyleFlag(style
);
455 bool wxToolBar::DoInsertTool(size_t pos
, wxToolBarToolBase
*toolBase
)
457 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, toolBase
);
460 switch ( tool
->GetStyle() )
462 case wxTOOL_STYLE_BUTTON
:
463 switch (tool
->GetKind())
466 tool
->m_item
= gtk_toggle_tool_button_new();
467 g_signal_connect(tool
->m_item
, "toggled",
468 G_CALLBACK(item_toggled
), tool
);
471 radioGroup
= GetRadioGroup(pos
);
474 // this is the first button in the radio button group,
475 // it will be toggled automatically by GTK so bring the
476 // internal flag in sync
479 tool
->m_item
= gtk_radio_tool_button_new(radioGroup
);
480 g_signal_connect(tool
->m_item
, "toggled",
481 G_CALLBACK(item_toggled
), tool
);
484 wxFAIL_MSG("unknown toolbar child type");
486 case wxITEM_DROPDOWN
:
488 tool
->m_item
= gtk_tool_button_new(NULL
, "");
489 g_signal_connect(tool
->m_item
, "clicked",
490 G_CALLBACK(item_clicked
), tool
);
493 if (!HasFlag(wxTB_NOICONS
))
495 GtkWidget
* image
= gtk_image_new();
496 gtk_tool_button_set_icon_widget(
497 GTK_TOOL_BUTTON(tool
->m_item
), image
);
499 gtk_widget_show(image
);
500 g_signal_connect(image
, "expose_event",
501 G_CALLBACK(image_expose_event
), tool
);
503 if (!tool
->GetLabel().empty())
505 gtk_tool_button_set_label(
506 GTK_TOOL_BUTTON(tool
->m_item
), wxGTK_CONV(tool
->GetLabel()));
507 // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
508 gtk_tool_item_set_is_important(tool
->m_item
, true);
510 if (!HasFlag(wxTB_NO_TOOLTIPS
) && !tool
->GetShortHelp().empty())
512 gtk_tool_item_set_tooltip(tool
->m_item
,
513 m_tooltips
, wxGTK_CONV(tool
->GetShortHelp()), "");
515 g_signal_connect(GTK_BIN(tool
->m_item
)->child
, "button_press_event",
516 G_CALLBACK(button_press_event
), tool
);
517 g_signal_connect(tool
->m_item
, "enter_notify_event",
518 G_CALLBACK(enter_notify_event
), tool
);
519 g_signal_connect(tool
->m_item
, "leave_notify_event",
520 G_CALLBACK(enter_notify_event
), tool
);
522 if (tool
->GetKind() == wxITEM_DROPDOWN
)
523 tool
->CreateDropDown();
524 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
527 case wxTOOL_STYLE_SEPARATOR
:
528 tool
->m_item
= gtk_separator_tool_item_new();
529 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
532 case wxTOOL_STYLE_CONTROL
:
533 wxWindow
* control
= tool
->GetControl();
534 if (control
->m_widget
->parent
== NULL
)
535 wxInsertChildInToolBar(this, control
);
536 tool
->m_item
= GTK_TOOL_ITEM(control
->m_widget
->parent
->parent
);
537 if (gtk_toolbar_get_item_index(m_toolbar
, tool
->m_item
) != int(pos
))
539 g_object_ref(tool
->m_item
);
540 gtk_container_remove(
541 GTK_CONTAINER(m_toolbar
), GTK_WIDGET(tool
->m_item
));
542 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
543 g_object_unref(tool
->m_item
);
545 // Inserted items "slide" into place using an animated effect that
546 // causes multiple size events on the item. Must set size request
547 // to keep item size from getting permanently set too small by the
548 // first of these size events.
549 const wxSize size
= control
->GetSize();
550 gtk_widget_set_size_request(control
->m_widget
, size
.x
, size
.y
);
553 gtk_widget_show(GTK_WIDGET(tool
->m_item
));
555 InvalidateBestSize();
560 bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase
* toolBase
)
562 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, toolBase
);
564 if (tool
->GetStyle() == wxTOOL_STYLE_CONTROL
)
566 // don't destroy the control here as we can be called from
567 // RemoveTool() and then we need to keep the control alive;
568 // while if we're called from DeleteTool() the control will
569 // be destroyed when wxToolBarToolBase itself is deleted
570 GtkWidget
* widget
= tool
->GetControl()->m_widget
;
571 gtk_container_remove(GTK_CONTAINER(widget
->parent
), widget
);
573 gtk_object_destroy(GTK_OBJECT(tool
->m_item
));
576 InvalidateBestSize();
580 GSList
* wxToolBar::GetRadioGroup(size_t pos
)
582 GSList
* radioGroup
= NULL
;
583 GtkToolItem
* item
= NULL
;
586 item
= gtk_toolbar_get_nth_item(m_toolbar
, int(pos
) - 1);
587 if (!GTK_IS_RADIO_TOOL_BUTTON(item
))
590 if (item
== NULL
&& pos
< m_tools
.size())
592 item
= gtk_toolbar_get_nth_item(m_toolbar
, int(pos
));
593 if (!GTK_IS_RADIO_TOOL_BUTTON(item
))
597 radioGroup
= gtk_radio_tool_button_get_group((GtkRadioToolButton
*)item
);
601 // ----------------------------------------------------------------------------
602 // wxToolBar tools state
603 // ----------------------------------------------------------------------------
605 void wxToolBar::DoEnableTool(wxToolBarToolBase
*toolBase
, bool enable
)
607 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, toolBase
);
610 gtk_widget_set_sensitive(GTK_WIDGET(tool
->m_item
), enable
);
613 void wxToolBar::DoToggleTool( wxToolBarToolBase
*toolBase
, bool toggle
)
615 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, toolBase
);
619 g_signal_handlers_block_by_func(tool
->m_item
, (void*)item_toggled
, tool
);
621 gtk_toggle_tool_button_set_active(
622 GTK_TOGGLE_TOOL_BUTTON(tool
->m_item
), toggle
);
624 g_signal_handlers_unblock_by_func(tool
->m_item
, (void*)item_toggled
, tool
);
628 void wxToolBar::DoSetToggle(wxToolBarToolBase
* WXUNUSED(tool
),
629 bool WXUNUSED(toggle
))
631 // VZ: absolutely no idea about how to do it
632 wxFAIL_MSG( _T("not implemented") );
635 // ----------------------------------------------------------------------------
636 // wxToolBar geometry
637 // ----------------------------------------------------------------------------
639 wxSize
wxToolBar::DoGetBestSize() const
641 // Unfortunately, if overflow arrow is enabled GtkToolbar only reports size
642 // of arrow. To get the real size, the arrow is temporarily disabled here.
643 // This is gross, since it will cause a queue_resize, and could potentially
644 // lead to an infinite loop. But there seems to be no alternative, short of
645 // disabling the arrow entirely.
646 gtk_toolbar_set_show_arrow(m_toolbar
, false);
647 const wxSize size
= wxToolBarBase::DoGetBestSize();
648 gtk_toolbar_set_show_arrow(m_toolbar
, true);
652 wxToolBarToolBase
*wxToolBar::FindToolForPosition(wxCoord
WXUNUSED(x
),
653 wxCoord
WXUNUSED(y
)) const
655 // VZ: GTK+ doesn't seem to have such thing
656 wxFAIL_MSG( _T("wxToolBar::FindToolForPosition() not implemented") );
658 return (wxToolBarToolBase
*)NULL
;
661 void wxToolBar::SetToolShortHelp( int id
, const wxString
& helpString
)
663 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, FindById(id
));
667 (void)tool
->SetShortHelp(helpString
);
670 gtk_tool_item_set_tooltip(tool
->m_item
,
671 m_tooltips
, wxGTK_CONV(helpString
), "");
676 void wxToolBar::SetToolNormalBitmap( int id
, const wxBitmap
& bitmap
)
678 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, FindById(id
));
681 wxCHECK_RET( tool
->IsButton(), wxT("Can only set bitmap on button tools."));
683 tool
->SetNormalBitmap(bitmap
);
688 void wxToolBar::SetToolDisabledBitmap( int id
, const wxBitmap
& bitmap
)
690 wxToolBarTool
* tool
= wx_static_cast(wxToolBarTool
*, FindById(id
));
693 wxCHECK_RET( tool
->IsButton(), wxT("Can only set bitmap on button tools."));
695 tool
->SetDisabledBitmap(bitmap
);
699 // ----------------------------------------------------------------------------
700 // wxToolBar idle handling
701 // ----------------------------------------------------------------------------
703 void wxToolBar::OnInternalIdle()
705 // Check if we have to show window now
706 if (GtkShowFromOnIdle()) return;
708 wxCursor cursor
= m_cursor
;
709 if (g_globalCursor
.Ok()) cursor
= g_globalCursor
;
713 /* I now set the cursor the anew in every OnInternalIdle call
714 as setting the cursor in a parent window also effects the
715 windows above so that checking for the current cursor is
718 if (HasFlag(wxTB_DOCKABLE
) && (m_widget
->window
))
720 /* if the toolbar is dockable, then m_widget stands for the
721 GtkHandleBox widget, which uses its own window so that we
722 can set the cursor for it. if the toolbar is not dockable,
723 m_widget comes from m_toolbar which uses its parent's
724 window ("windowless windows") and thus we cannot set the
726 gdk_window_set_cursor( m_widget
->window
, cursor
.GetCursor() );
729 wxToolBarToolsList::compatibility_iterator node
= m_tools
.GetFirst();
732 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->GetData();
733 node
= node
->GetNext();
737 GdkWindow
* window
= GTK_WIDGET(tool
->m_item
)->window
;
741 gdk_window_set_cursor( window
, cursor
.GetCursor() );
747 if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
748 UpdateWindowUI(wxUPDATE_UI_FROMIDLE
);
752 // ----------------------------------------------------------------------------
756 wxToolBar::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
758 return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new
);
761 #endif // wxUSE_TOOLBAR_NATIVE