

function MLC_SetupBubble()
	--MLC_BubbleFrame = 
	--MLC_AnimatedPonyBox
	
	local backdrop = {
	  bgFile = "Interface\\AddOns\\MyLittleCompanion\\Images\\Solid",  -- path to the background texture
	  edgeFile = "Interface\\AddOns\\MyLittleCompanion\\Images\\Bubble",  -- path to the border texture
	  edgeSize = 20,  -- thickness of edge segments and square size of edge corners (in pixels)
	  insets = {    -- distance from the edges of the frame to those of the background texture (in pixels)
		left = 5,
		right = 5,
		top = 5,
		bottom = 5
	  }
	}
	
	MLC_BubbleFrame = CreateFrame("Frame", "MLC_BubbleFrame", MLC_AnimatedPonyBox)
	MLC_BubbleFrame:SetPoint("Bottom", MLC_AnimatedPonyBox, "Top", 0,-40);
	MLC_BubbleFrame:SetWidth(140); 
	MLC_BubbleFrame:SetHeight(30);
	MLC_BubbleFrame:SetBackdrop(backdrop);
	MLC_BubbleFrame:SetBackdropColor(0,1,0);
	MLC_BubbleFrame:SetBackdropBorderColor(1,0,0);
	
	MLC_BubbleFrame:Hide();
	
	MLC_BubbleSpeechBackground = MLC_BubbleFrame:CreateTexture("MLC_BubbleSpeechBackground")
	MLC_BubbleSpeechBackground:SetPoint("TopLeft", MLC_BubbleFrame, "BottomLeft", 0,6);
	MLC_BubbleSpeechBackground:SetWidth(32); 
	MLC_BubbleSpeechBackground:SetHeight(16);
	MLC_BubbleSpeechBackground:SetTexture("Interface\\AddOns\\MyLittleCompanion\\Images\\BubbleBottomBackdrop")
	MLC_BubbleSpeechBackground:SetVertexColor(0,1,0);
	
	MLC_BubbleSpeechOutline = MLC_BubbleFrame:CreateTexture("MLC_BubbleSpeechOutline")
	MLC_BubbleSpeechOutline:SetPoint("Center", MLC_BubbleSpeechBackground, "Center");
	MLC_BubbleSpeechOutline:SetWidth(32); 
	MLC_BubbleSpeechOutline:SetHeight(16);
	MLC_BubbleSpeechOutline:SetTexture("Interface\\AddOns\\MyLittleCompanion\\Images\\BubbleBottom")
	MLC_BubbleSpeechOutline:SetVertexColor(1,0,0);
	
	MLC_BubbleText =  MLC_BubbleFrame:CreateFontString("MLC_BubbleText" ,"ARTWORK","GameFontNormal");
	MLC_BubbleText:SetPoint("Top", 0, -7)
	MLC_BubbleText:SetWidth(120);
	MLC_BubbleText:SetJustifyH("Center");
	MLC_BubbleText:SetNonSpaceWrap(true);
	
	MLC_SetBubbleText("ScrollingMessageFrame has all of the methods from UIObject, FontInstance, Region and Frame, plus the following:")
	--FontString:SetText("text")
	
	local r1,g1,b1 = MLC_HexToRGBPerc(MLC_AnimationData[MLC_DB["Pony"]]["BackdropColor"])
	local r2,g2,b2 = MLC_HexToRGBPerc(MLC_AnimationData[MLC_DB["Pony"]]["BorderColor"])
	local r3,g3,b3 = MLC_HexToRGBPerc(MLC_AnimationData[MLC_DB["Pony"]]["TextColor"])
	
	MLC_SetBubbleColor(r1,g1,b1, r2,g2,b2, r3,g3,b3)	--middle, outer, text
end

function MLC_SetBubbleColor(r1,g1,b1, r2,g2,b2, r3,g3,b3)	--middle, outer, text
	MLC_BubbleFrame:SetBackdropColor(r1,g1,b1);
	MLC_BubbleFrame:SetBackdropBorderColor(r2,g2,b2);
	
	MLC_BubbleSpeechBackground:SetVertexColor(r1,g1,b1);
	MLC_BubbleSpeechOutline:SetVertexColor(r2,g2,b2);
	
	MLC_BubbleText:SetTextColor(r3,g3,b3);
end

function MLC_SetBubblePoint(LeftOrRight)	-- "Left" or "Right"
	MLC_BubbleSpeechBackground:ClearAllPoints();
	
	if LeftOrRight == "Left" then
		MLC_BubbleSpeechBackground:SetPoint("TopLeft", MLC_BubbleFrame, "BottomLeft", 10,7);
		MLC_BubbleSpeechBackground:SetTexCoord(1, 0, 0, 1);
		MLC_BubbleSpeechOutline:SetTexCoord(1, 0, 0, 1);
	else
		MLC_BubbleSpeechBackground:SetPoint("TopRight", MLC_BubbleFrame, "BottomRight", -10,7);
		MLC_BubbleSpeechBackground:SetTexCoord(0, 1, 0, 1);
		MLC_BubbleSpeechOutline:SetTexCoord(0, 1, 0, 1);
	end
end

function MLC_SetBubbleText(BubbleText)
	MLC_BubbleText:SetText(BubbleText);
	
	MLC_BubbleFrame:SetHeight(MLC_BubbleText:GetHeight() + 16)
end