OpUnreadBadge::OpUnreadBadge() : OpButton(OpButton::TYPE_CUSTOM, OpButton::STYLE_TEXT) , m_minimum_width(0) { #ifdef QUICK_TOOLKIT_ACCORDION_MAC_STYLE // Mac has ugly unread counts that need to be center aligned SetJustify(JUSTIFY_CENTER, FALSE); init_status = SetText(UNI_L("00")); #else SetJustify(JUSTIFY_RIGHT, FALSE); init_status = SetText(UNI_L("0000")); #endif // QUICK_TOOLKIT_ACCORDION_MAC_STYLE CHECK_STATUS(init_status); SetDead(TRUE); INT32 h; VisualDeviceHandler vis_dev_handler(this); GetRequiredSize(m_minimum_width, h); init_status = SetText(UNI_L("")); }
void OpBubble::UpdatePlacement(const OpRect &target_screen_rect) { INT32 margin_left = 0, margin_top = 0, margin_right = 0, margin_bottom = 0; #ifdef SKIN_SUPPORT OpWidget* root = m_widget_container->GetRoot(); root->GetBorderSkin()->GetMargin(&margin_left, &margin_top, &margin_right, &margin_bottom); #endif PLACEMENT placement = GetDefaultPlacement(); ALIGNMENT alignment = GetDefaultAlignment(); INT32 width = 0, height = 0; GetRequiredSize(width, height); m_placement_rect = GetPlacement(width, height, margin_left, margin_top, margin_right, margin_bottom, target_screen_rect, placement, alignment); m_current_placement = placement; #ifdef SKIN_SUPPORT SkinArrow *arrow = root->GetBorderSkin()->GetArrow(); arrow->Reset(); if (placement == PLACEMENT_BOTTOM) arrow->SetTop(); else if (placement == PLACEMENT_TOP) arrow->SetBottom(); else if (placement == PLACEMENT_LEFT) arrow->SetRight(); else if (placement == PLACEMENT_RIGHT) arrow->SetLeft(); if (alignment == ALIGNMENT_MIDDLE) arrow->SetOffset(50); else if (alignment == ALIGNMENT_END) arrow->SetOffset(100); #endif if (m_visible) Show(); }
static void* DebugAllocator(size_t size, bool Noexcept, ALLOCATION_TYPE type,const char* Function, const char* File, int Line) { size_t realSize = GetRequiredSize(size); auto Info = static_cast<MEMINFO*>(malloc(realSize)); if (!Info) { if (Noexcept) return nullptr; else throw far_bad_alloc(File, Line, Function, type, size); } Info->AllocationType = type; Info->Size = realSize; Info->Function = Function; Info->File = File; Info->Line = Line; GetMarker(Info) = EndMarker; RegisterBlock(Info); return ToUser(Info); }