Use a quad tree to store the UI components and travel down the tree based on the position of the cursor.
This should have O(log4(n)) complexity.
Alternatively, like fastcall said,
xIndex = mouse.x % (number of horizontal boxes);
yIndex = mouse.y % (number of vertical boxes);
UI[xIndex][yIndex].processClick();
The downside here is your UI must fit into a regular grid, the quad tree method would be an irregular grid, and probably more trouble than it's worth :P
I assure you a modern PC can calculate thousands of if(mouse.x < uiElement.width+uiElement.x && mouse.x > uiElement.x) per frame though... No one would ever know that you used anything less than the most efficient code possible in this case.
edit --
Roughly 1190476 UI elements could be processed per frame on a 1GHz cpu at 60fps >.>
In practice, probably more than that, I was pretty generous with an estimate of 14 instructions for two of those if statements... (7 each, one addition, two comparisons, one logical and, and three movs (mouse positions will be assumed to have an effectively permanent register), in fact, I think my assembly for that is pretty inefficient, and the compiler would do better work >.>