void BoxContainer::_notification(int p_what) { switch(p_what) { case NOTIFICATION_SORT_CHILDREN: { _resort(); } break; } }
void GraphNode::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { Ref<StyleBox> sb=get_stylebox("frame"); Ref<Texture> port =get_icon("port"); Ref<Texture> close =get_icon("close"); int close_offset = get_constant("close_offset"); Ref<Font> title_font = get_font("title_font"); int title_offset = get_constant("title_offset"); Color title_color = get_color("title_color"); Point2i icofs = -port->get_size()*0.5; int edgeofs=get_constant("port_offset"); icofs.y+=sb->get_margin(MARGIN_TOP); draw_style_box(sb,Rect2(Point2(),get_size())); int w = get_size().width-sb->get_minimum_size().x; if (show_close) w-=close->get_width(); draw_string(title_font,Point2(sb->get_margin(MARGIN_LEFT),-title_font->get_height()+title_font->get_ascent()+title_offset),title,title_color,w); if (show_close) { Vector2 cpos = Point2(w+sb->get_margin(MARGIN_LEFT),-close->get_height()+close_offset); draw_texture(close,cpos); close_rect.pos=cpos; close_rect.size=close->get_size(); } else { close_rect=Rect2(); } for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) { if (E->key() < 0 || E->key()>=cache_y.size()) continue; if (!slot_info.has(E->key())) continue; const Slot &s=slot_info[E->key()]; //left if (s.enable_left) port->draw(get_canvas_item(),icofs+Point2(edgeofs,cache_y[E->key()]),s.color_left); if (s.enable_right) port->draw(get_canvas_item(),icofs+Point2(get_size().x-edgeofs,cache_y[E->key()]),s.color_right); } } if (p_what==NOTIFICATION_SORT_CHILDREN) { _resort(); } }
void SplitContainer::_notification(int p_what) { switch(p_what) { case NOTIFICATION_SORT_CHILDREN: { _resort(); } break; case NOTIFICATION_MOUSE_ENTER: { mouse_inside=true; update(); } break; case NOTIFICATION_MOUSE_EXIT: { mouse_inside=false; update(); } break; case NOTIFICATION_DRAW: { if (!_getch(0) || !_getch(1)) return; if (collapsed || (!mouse_inside && get_constant("autohide"))) return; int sep=dragger_visible?get_constant("separation"):0; Ref<Texture> tex = get_icon("grabber"); Size2 size=get_size(); if (vertical) { //draw_style_box( get_stylebox("bg"), Rect2(0,middle_sep,get_size().width,sep)); if (dragger_visible) draw_texture(tex,Point2i((size.x-tex->get_width())/2,middle_sep+(sep-tex->get_height())/2)); } else { //draw_style_box( get_stylebox("bg"), Rect2(middle_sep,0,sep,get_size().height)); if (dragger_visible) draw_texture(tex,Point2i(middle_sep+(sep-tex->get_width())/2,(size.y-tex->get_height())/2)); } } break; } }
void SplitContainer::_notification(int p_what) { switch (p_what) { case NOTIFICATION_SORT_CHILDREN: { _resort(); } break; case NOTIFICATION_MOUSE_ENTER: { mouse_inside = true; update(); } break; case NOTIFICATION_MOUSE_EXIT: { mouse_inside = false; update(); } break; case NOTIFICATION_DRAW: { if (!_getch(0) || !_getch(1)) return; if (collapsed || (!mouse_inside && get_constant("autohide"))) return; int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_constant("separation") : 0; Ref<Texture> tex = get_icon("grabber"); Size2 size = get_size(); if (dragger_visibility == DRAGGER_VISIBLE) { if (vertical) draw_texture(tex, Point2i((size.x - tex->get_width()) / 2, middle_sep + (sep - tex->get_height()) / 2)); else draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2)); } } break; } }
void GraphNode::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { Ref<StyleBox> sb; if (comment) { sb = get_stylebox( selected? "commentfocus" : "comment"); } else { sb = get_stylebox( selected ? "selectedframe" : "frame"); } sb=sb->duplicate(); sb->call("set_modulate",modulate); Ref<Texture> port =get_icon("port"); Ref<Texture> close =get_icon("close"); Ref<Texture> resizer =get_icon("resizer"); int close_offset = get_constant("close_offset"); Ref<Font> title_font = get_font("title_font"); int title_offset = get_constant("title_offset"); Color title_color = get_color("title_color"); Point2i icofs = -port->get_size()*0.5; int edgeofs=get_constant("port_offset"); icofs.y+=sb->get_margin(MARGIN_TOP); draw_style_box(sb,Rect2(Point2(),get_size())); switch(overlay) { case OVERLAY_DISABLED: { } break; case OVERLAY_BREAKPOINT: { draw_style_box(get_stylebox("breakpoint"),Rect2(Point2(),get_size())); } break; case OVERLAY_POSITION: { draw_style_box(get_stylebox("position"),Rect2(Point2(),get_size())); } break; } int w = get_size().width-sb->get_minimum_size().x; if (show_close) w-=close->get_width(); draw_string(title_font,Point2(sb->get_margin(MARGIN_LEFT),-title_font->get_height()+title_font->get_ascent()+title_offset),title,title_color,w); if (show_close) { Vector2 cpos = Point2(w+sb->get_margin(MARGIN_LEFT),-close->get_height()+close_offset); draw_texture(close,cpos); close_rect.pos=cpos; close_rect.size=close->get_size(); } else { close_rect=Rect2(); } for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) { if (E->key() < 0 || E->key()>=cache_y.size()) continue; if (!slot_info.has(E->key())) continue; const Slot &s=slot_info[E->key()]; //left if (s.enable_left) { Ref<Texture> p = port; if (s.custom_slot_left.is_valid()) { p=s.custom_slot_left; } p->draw(get_canvas_item(),icofs+Point2(edgeofs,cache_y[E->key()]),s.color_left); } if (s.enable_right) { Ref<Texture> p = port; if (s.custom_slot_right.is_valid()) { p=s.custom_slot_right; } p->draw(get_canvas_item(),icofs+Point2(get_size().x-edgeofs,cache_y[E->key()]),s.color_right); } } if (resizeable) { draw_texture(resizer,get_size()-resizer->get_size()); } } if (p_what==NOTIFICATION_SORT_CHILDREN) { _resort(); } }
void BoxContainer::set_alignment(AlignMode p_align) { align = p_align; _resort(); }